Socket
Book a DemoInstallSign in
Socket

static_config

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

static_config

0.0.4
bundlerRubygems
Version published
Maintainers
1
Created
Source

Example

MyAppConfig = StaticConfig.build do
  first do
    env_yaml 'my_app_config'
    file Rails.root.join('config/my_app.yml'), :section => Rails.env
  end
  env 'MY_APP'
end

Now you have an object MyAppConfig that you can use anywhere.

For instance, if your config/my_app.yml looks like this:

development:
  user:
    selected:
      color: orange

You could get orange by doing this:

MyAppConfig.user.selected.color

You could override it at runtime by setting the environment variable MY_APP_USER_SELECTED_COLOR.

You can also override the entire config/my_app.yml file by storing some yaml in an environment variable called my_app_config.

To get your config to reload on each request in Rails, add this:

Rails.application.config.to_prepare do
  MyAppConfig.reload!
end

Build Status

FAQs

Package last updated on 07 Aug 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.