You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it just me or is the following not very readable?
Figaro.env.stripe_api_key
As compared to something like
config.stripe_api_key
I think it would be nice if Figaro had an easy way to change the name or method of accessing the env variables. You can't just do
config = Figaro.env
So as a workaround you can do something like this in the config/initializers/figaro.rb
#Rename Figaro to be something meaningful.
module Config
extend self
def respond_to?(method, *)
Figaro::ENV.respond_to?(method)
end
private
def method_missing(method, *)
Figaro::ENV.send(method)
end
end
#Now you can access the value via
Config.stripe_api_key
Is this the best/easiest way to have a nice readable way to access the env variables?
The text was updated successfully, but these errors were encountered:
Is it just me or is the following not very readable?
As compared to something like
I think it would be nice if Figaro had an easy way to change the name or method of accessing the env variables. You can't just do
So as a workaround you can do something like this in the config/initializers/figaro.rb
Is this the best/easiest way to have a nice readable way to access the env variables?
The text was updated successfully, but these errors were encountered: