Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spec/commands/new_command_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ describe AmberCLI::Commands::NewCommand do
config = YAML.parse(File.read(File.join(destination, "config/environments/development.yml")))
config["server"]["port"].as_i.should eq(3000)
config["database"]["url"].as_s.should contain("sqlite3:")
%w[development test].each do |environment_name|
session_config = YAML.parse(File.read(File.join(destination, "config/environments/#{environment_name}.yml")))["session"]
session_config["store"].as_s.should eq("signed_cookie")
session_config["expires"].as_i.should eq(1_209_600)
end

routes = File.read(File.join(destination, "config/routes.cr"))
routes.should contain("pipeline :static")
Expand Down
8 changes: 7 additions & 1 deletion src/amber_cli/commands/new_command.cr
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,15 @@ 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`.
store: "signed_cookie"
# Used only when store is adapter: memory (at most 10,000 sessions per process) or redis.
adapter: "memory"
expires: 0
# 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.
expires: 1209600

logging:
severity: "#{severity}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ 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`.
store: signed_cookie
# Used only when store is adapter: memory (at most 10,000 sessions per process) or redis.
adapter: memory
expires: 0
# 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.
expires: 1209600

logging:
severity: debug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ 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`.
store: signed_cookie
# Used only when store is adapter: memory (at most 10,000 sessions per process) or redis.
adapter: memory
expires: 0
# 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.
expires: 1209600

logging:
severity: info
Expand Down
8 changes: 7 additions & 1 deletion src/amber_cli/templates/app/config/environments/test.yml.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ 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`.
store: signed_cookie
# Used only when store is adapter: memory (at most 10,000 sessions per process) or redis.
adapter: memory
expires: 0
# 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.
expires: 1209600

logging:
severity: warn
Expand Down
Loading