-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextensive_envfile
More file actions
64 lines (52 loc) · 1.88 KB
/
Copy pathextensive_envfile
File metadata and controls
64 lines (52 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- mode: ruby -*-¬
# We allow defaults for local development (and local tests), but want our CI
# to mimic our production as much as possible.
# New developers that don't have RACK_ENV set, will in this way not be presented with a huge
# list of missing variables, as defaults are still enabled.
not_production_nor_ci = ->{ !(ENV['RACK_ENV'] == 'production' || ENV['CI']) }
enable_defaults!(¬_production_nor_ci)
# Your code will likely not use ENVied.RACK_ENV (better use Rails.env),
# we want it to be present though; heck, we're using it in this file!
variable :RACK_ENV
variable :FORCE_SSL, :boolean, default: 'false'
variable :PORT, :integer, default: '3000'
variable :TAGS, :array, default: 'tag1,tag2'
# ENVied.TAGS
# => ['tag1', 'tag2']
# generate the default value using the value of PORT:
variable :PUBLIC_HOST_WITH_PORT, :string, default: proc { |envied|
"localhost:#{envied.PORT}"
}
# Or better yet, use the URI type:
variable :SITE_URI, :uri, default: 'http://localhost:5000/'
# So with that you could now do:
# ```
# config.action_mailer.default_url_options = {
# protocol: ENVied.SITE_URI.scheme,
# host: ENVied.SITE_URI.host
# }
# config.action_mailer.asset_host = ENVied.SITE_URI.to_s
# ```
group :production do
variable :MAIL_PAAS_USERNAME
variable :DATABASE_URL
end
group :ci do
# ci-only stuff
end
group :not_ci do
# CI needs no puma-threads, and sidekiq-stuff etc.
# Define that here:
variable :MIN_THREADS, :integer, default: '1'
# more...
end
# Depending on our situation, we can now require the correct groups in our initialization-file:
# At local machines:
# ENVied.require(:default, :development, :not_ci) or
# ENVied.require(:default, :test, :not_ci)
# At the server:
# ENVied.require(:default, :production, :not_ci)
# At CI:
# ENVied.require(:default, :test, :ci)
# All in one line:
# ENVied.require(:default, ENV['RACK_ENV'], (ENV['CI'] ? :ci : :not_ci))