From 84dbc73ae6ee6b3b38f8400376044f2de5e8f079 Mon Sep 17 00:00:00 2001 From: "Seth T." Date: Fri, 20 Nov 2026 13:52:44 -0500 Subject: [PATCH] Correct the generated session comments The generated environment files said that store: signed_cookie keeps nothing on the server and that the memory adapter holds at most 10,000 sessions per process. Amber 2.0.0-beta.11, which generated apps pin, does neither: it keeps every session in the memory adapter whatever store says, the memory adapter has no size limit, and store: adapter fails validation. A session with expires: 0 is never removed either. The comments now describe beta.11 as it is and name amberframework/amber#1455, which makes cookie stores keep nothing on the server, accepts store: adapter, and caps the memory adapter at session.max_memory_sessions (10,000 by default). --- src/amber_cli/commands/new_command.cr | 16 ++++++++++------ .../app/config/environments/development.yml.ecr | 16 ++++++++++------ .../app/config/environments/production.yml.ecr | 16 ++++++++++------ .../app/config/environments/test.yml.ecr | 16 ++++++++++------ 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/amber_cli/commands/new_command.cr b/src/amber_cli/commands/new_command.cr index da8195e..9f6c3b5 100644 --- a/src/amber_cli/commands/new_command.cr +++ b/src/amber_cli/commands/new_command.cr @@ -812,14 +812,18 @@ database: session: key: "#{name}.session" - # signed_cookie keeps the session in the visitor's cookie: tamper-proof, readable by - # the visitor, about 4 KB, and nothing is held on the server. encrypted_cookie also - # hides it from the visitor. adapter keeps sessions on the server through `adapter`. + # Amber 2.0.0-beta.11 keeps every session on the server, in `adapter`, whichever store + # is named here; the cookie carries only the encrypted session id. It accepts + # signed_cookie, encrypted_cookie and redis. Once amberframework/amber#1455 is + # released, signed_cookie and encrypted_cookie keep the session in the visitor's + # cookie with nothing held on the server, and store: adapter becomes valid. store: "signed_cookie" - # Used only when store is adapter: memory (at most 10,000 sessions per process) or redis. + # memory, or an adapter the app registers with Amber::Adapters::AdapterFactory. + # The memory adapter has no size limit in beta.11; amber#1455 caps it at + # session.max_memory_sessions (10,000 by default). adapter: "memory" - # Seconds a session lasts after its last change (two weeks). 0 makes cookie sessions - # end when the browser closes and lets server-side sessions live until evicted. + # Seconds a session lasts after its last change (two weeks). 0 makes the cookie end + # when the browser closes; a server-side session with 0 never expires. expires: 1209600 static: diff --git a/src/amber_cli/templates/app/config/environments/development.yml.ecr b/src/amber_cli/templates/app/config/environments/development.yml.ecr index 0b48222..9dc36a0 100644 --- a/src/amber_cli/templates/app/config/environments/development.yml.ecr +++ b/src/amber_cli/templates/app/config/environments/development.yml.ecr @@ -17,14 +17,18 @@ when "mysql" -%> session: key: <%= @name %>.session - # signed_cookie keeps the session in the visitor's cookie: tamper-proof, readable by - # the visitor, about 4 KB, and nothing is held on the server. encrypted_cookie also - # hides it from the visitor. adapter keeps sessions on the server through `adapter`. + # Amber 2.0.0-beta.11 keeps every session on the server, in `adapter`, whichever store + # is named here; the cookie carries only the encrypted session id. It accepts + # signed_cookie, encrypted_cookie and redis. Once amberframework/amber#1455 is + # released, signed_cookie and encrypted_cookie keep the session in the visitor's + # cookie with nothing held on the server, and store: adapter becomes valid. store: signed_cookie - # Used only when store is adapter: memory (at most 10,000 sessions per process) or redis. + # memory, or an adapter the app registers with Amber::Adapters::AdapterFactory. + # The memory adapter has no size limit in beta.11; amber#1455 caps it at + # session.max_memory_sessions (10,000 by default). adapter: memory - # Seconds a session lasts after its last change (two weeks). 0 makes cookie sessions - # end when the browser closes and lets server-side sessions live until evicted. + # Seconds a session lasts after its last change (two weeks). 0 makes the cookie end + # when the browser closes; a server-side session with 0 never expires. expires: 1209600 logging: diff --git a/src/amber_cli/templates/app/config/environments/production.yml.ecr b/src/amber_cli/templates/app/config/environments/production.yml.ecr index b394efc..4804b80 100644 --- a/src/amber_cli/templates/app/config/environments/production.yml.ecr +++ b/src/amber_cli/templates/app/config/environments/production.yml.ecr @@ -11,14 +11,18 @@ database: session: key: <%= @name %>.session - # signed_cookie keeps the session in the visitor's cookie: tamper-proof, readable by - # the visitor, about 4 KB, and nothing is held on the server. encrypted_cookie also - # hides it from the visitor. adapter keeps sessions on the server through `adapter`. + # Amber 2.0.0-beta.11 keeps every session on the server, in `adapter`, whichever store + # is named here; the cookie carries only the encrypted session id. It accepts + # signed_cookie, encrypted_cookie and redis. Once amberframework/amber#1455 is + # released, signed_cookie and encrypted_cookie keep the session in the visitor's + # cookie with nothing held on the server, and store: adapter becomes valid. store: signed_cookie - # Used only when store is adapter: memory (at most 10,000 sessions per process) or redis. + # memory, or an adapter the app registers with Amber::Adapters::AdapterFactory. + # The memory adapter has no size limit in beta.11; amber#1455 caps it at + # session.max_memory_sessions (10,000 by default). adapter: memory - # Seconds a session lasts after its last change (two weeks). 0 makes cookie sessions - # end when the browser closes and lets server-side sessions live until evicted. + # Seconds a session lasts after its last change (two weeks). 0 makes the cookie end + # when the browser closes; a server-side session with 0 never expires. expires: 1209600 logging: diff --git a/src/amber_cli/templates/app/config/environments/test.yml.ecr b/src/amber_cli/templates/app/config/environments/test.yml.ecr index 3a70ef7..47141c0 100644 --- a/src/amber_cli/templates/app/config/environments/test.yml.ecr +++ b/src/amber_cli/templates/app/config/environments/test.yml.ecr @@ -17,14 +17,18 @@ when "mysql" -%> session: key: <%= @name %>.session - # signed_cookie keeps the session in the visitor's cookie: tamper-proof, readable by - # the visitor, about 4 KB, and nothing is held on the server. encrypted_cookie also - # hides it from the visitor. adapter keeps sessions on the server through `adapter`. + # Amber 2.0.0-beta.11 keeps every session on the server, in `adapter`, whichever store + # is named here; the cookie carries only the encrypted session id. It accepts + # signed_cookie, encrypted_cookie and redis. Once amberframework/amber#1455 is + # released, signed_cookie and encrypted_cookie keep the session in the visitor's + # cookie with nothing held on the server, and store: adapter becomes valid. store: signed_cookie - # Used only when store is adapter: memory (at most 10,000 sessions per process) or redis. + # memory, or an adapter the app registers with Amber::Adapters::AdapterFactory. + # The memory adapter has no size limit in beta.11; amber#1455 caps it at + # session.max_memory_sessions (10,000 by default). adapter: memory - # Seconds a session lasts after its last change (two weeks). 0 makes cookie sessions - # end when the browser closes and lets server-side sessions live until evicted. + # Seconds a session lasts after its last change (two weeks). 0 makes the cookie end + # when the browser closes; a server-side session with 0 never expires. expires: 1209600 logging: