1

Is it possible to upload an untracked file to Heroku using the CLI? Something like

$ heroku upload config/secrets.yml

I have a file that I do not want to track in my Github repository that is deploying to Heroku, but I need it to make the application work on Heroku.

asked Feb 21, 2017 at 19:09

1 Answer 1

1

In order to achieve what you're trying to do with Heroku, you need to do it a little differently. You can use a config file that is checked into the repo, but don't store any of your keys in the config. Refer to environment variables to provide the actual values to use based on that environment. (local/staging/production) You then set your env vars locally just as you would on Heroku. It's all the same on each environment which is what you want. Here's a short example:

 staging: {
 env: 'staging',
 root: rootPath,
 app: {
 name: appname,
 assets_path: '/build/dist',
 main: packageJSON.main
 },
 port: process.env.PORT,
 db: {
 MONGODB_URI: process.env.MONGODB_URI
 },
 redis: {
 REDIS_URL: process.env.REDIS_URL
 },
 logs: {
 LE_TOKEN: process.env.LE_TOKEN
 },
 auth: {
 CLIENT_ID: process.env.AUTH0_CLIENT_ID,
 CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
 DOMAIN: process.env.AUTH0_DOMAIN,
 CALLBACK: process.env.AUTH0_CALLBACK_URL,
 TOKEN: process.env.AUTH0_TOKEN
 },
 google: {
 MAPS_KEY: process.env.GOOGLE_MAPS_KEY
 }
 }
answered Feb 28, 2017 at 19:53
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, Nathan! I'm definitely going to try this next time I deploy a project to Heroku. It was a really quick solution for deploying a Rails app, but then I tried a Django app and it was more of a headache. Not sure when I'll have another chance to give it a go.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.