3 ms·
Envconfig: Environmentally friendly Ruby configuration
- amalag 13y agoHow is this different from dotenv ?
- vinceguidry 13y agoI'm also having trouble figuring out what it does. Is it only for certain services?
- snikch 13y agodotenv allows you to store env values in the .env file. envconfig handles normalizing the various ENV values from providers into a single configuration. Every provider has a different env value, such as POSTMARK_SMTP_SERVER, or SENDGRID_SMTP_SERVER. envconfig knows about these and provides a single service agnostic interface to that information. .env and envconfig work very well together.
- paulannesley 13y agodotenv reads a file into Ruby's ENV. envconfig reads Ruby's ENV and exposes it as a useful configuration object. envconfig-rails uses that to e.g. push the SMTP settings into ActionMailer. The key value, though, is that envconfig knows about Heroku and Broadstack add-on ENV names. e.g. when you add the MemCachier Addon, it simply puts MEMCACHIER_SERVERS, MEMCACHIER_USERNAME, MEMCACHIER_PASSWORD into your ENV. Envconfig knows those var names, and assigns them to the memcached service. If you looks at the various provider mappings in e.g. https://github.com/broadstack/envconfig/blob/master/lib/envconfig/smtp.rb https://github.com/broadstack/envconfig/blob/master/lib/envc... you'll see that it knows about ENV-provided, and static, configuration for each provider.