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

setting whenever RAILS_ENV #63

Open
vcavallo opened this issue Feb 2, 2017 · 5 comments
Open

setting whenever RAILS_ENV #63

vcavallo opened this issue Feb 2, 2017 · 5 comments

Comments

@vcavallo
Copy link
Contributor

vcavallo commented Feb 2, 2017

If deploying to a staging environment, it is necessary to get the env variable into whenever so it can write the crontab properly.

I'll submit a pull request that accomplishes this for me.

@arBmind
Copy link
Member

arBmind commented Feb 2, 2017

You should use the same pattern as the module.

shell: >
   {{ profile }}'bundle exec rake db:migrate'

profile is used to load all the environment variables of the app_user profile. This contains the DATABASE_URL and RAILS_ENV etc. So it should be preferred.

@vcavallo
Copy link
Contributor Author

vcavallo commented Feb 2, 2017

If i'm not mistaken, the environment needs to be included in the command line arguments to whenever, as well. See my pull request for explanation:
#64

@arBmind
Copy link
Member

arBmind commented Feb 2, 2017

No, the RAILS_ENV environment variable is always used if none is given as a commandline argument.

@vcavallo
Copy link
Contributor Author

vcavallo commented Feb 2, 2017

I realize it's piped through ansible in the profile, but how does it get into the the crontab via whenever? From what I read in the whenever gem, when the crontab writing command is called, unless the environment is specified in the schedule.rb file (and subsequently provided to this file) then it defaults to production.

@arBmind
Copy link
Member

arBmind commented Feb 2, 2017

Ok, I see your point... yes this is an issue.
Your solution is not the right way.

I add a comment to your pull request.

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

2 participants