Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Figaro.application.path #183

Open
joallard opened this issue Feb 16, 2015 · 6 comments
Open

Changing Figaro.application.path #183

joallard opened this issue Feb 16, 2015 · 6 comments

Comments

@joallard
Copy link

I initially commented on e8b302f, but I figure opening an issue will be better for tracking.

How do you actually change the path of config/application.yml? To be honest, I don't like that default, as it always collides with config/application.rb in autocompletion.

The tests allude to Figaro::Application.new(path = ""), but it's not us who actually call that function.

The documentation is silent as to how to do that

@mrjamesriley
Copy link

Seems there's no direct configuration provided for this, at least for the Rails usage. The figaro install allows you to pass in the path, e.g figaro install -p config/passport.yml - but this only creates the file, and appends it to the git ignore. But then the gem will still look for the file at config/application.yml.

This works when used in an initializer:

# config/initializers/figaro.rb
Figaro.application.path = Rails.root.join('config', 'passport.yml')
Figaro.load

Although it's more of a workaround, as Figaro.load would be getting called for the second time here.

@joallard
Copy link
Author

Yup, it's the workaround I ended up using for the time being. The crux is that because Figaro runs on before_configuration, you can't even config it with an initializer. I wonder where we could make space to put some settings.

@joallard joallard changed the title Documentation: How to change Figaro path Changing Figaro.application.path Feb 19, 2015
@joallard
Copy link
Author

Also to note that the param in the workaround will be ignored by figaro heroku:set

@joallard
Copy link
Author

joallard commented Jul 2, 2015

What if, dirty fix, we checked if there was a config/initializers/figaro.rb and loaded that before the cli

@joallard
Copy link
Author

@laserlemon Would you accept a PR that would run config/initializers/figaro.rb on load if present? Dirty fix, but I can't think of another strategy

@mikeymurph77
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants