keyFilename makes 12-factor app style deployment difficult #136
Closed
Description
I'm trying to use cloud storage which the documentation says I should initialize as such:
var gcloud = require('gcloud'),
bucket = new gcloud.storage.Bucket({
bucketName: YOUR_BUCKET_NAME,
keyFilename: '/path/to/the/key.json'
});
I dug into the code and this keyFilename option seems to be the only way to specify this required info, and it expects a filepath string. This makes storing the key's JSON as an environmental variable pretty complicated since I'd have to write the env value to a file, then pass the path to gcloud.
This seems to be a similar issue someone faced with Google APIs, a key file, and Heroku: http://ar.zu.my/how-to-store-private-key-files-in-heroku/
As he outlines, it seems there are four options, none super simple:
- Include the private key in my git repository.
- Store it in S3, and pull it when needed.
- Use custom build-pack which will include the key.
- Store it as config vars.
Even just having the option to pass this information in as a Javascript object (which makes sense for a node library) would be nice.