Sha256: fa3ae61cc5be89b82a49c570fc9f0f29d5034c5d165b80ee4c877f0993fba9c7

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

# -*- 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!(&not_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'
# generate the default value using the value of PORT:
variable :PUBLIC_HOST_WITH_PORT, :string, default: proc {|envied| "localhost:#{envied.PORT}" }

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))

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
envied-0.8.2 examples/extensive_envfile