-
Notifications
You must be signed in to change notification settings - Fork 164
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
Allow to get the ACCESS_TOKEN from an environment variable #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts on this:
- Should the environment variable be called something more specific to avoid potential collisions? Perhaps
STDLIB_ACCESS_TOKEN
? - As it stands, this change will still require the
.stdlib
file to exist (it'll throw otherwise). Should the majority of thereadCredentials
function be wrapped in anif
to skip reading the file if the environment variable is present? - Do we need another env variable correlating to the
CREATED_AT
key from.stdlib
? Probably not, as it doesn't appear to be used anywhere other than when writing the file. Just curious.
That's correct! I thought in a I'm going to fix this. This was thought as a fast solution to deploy with any CI system. Thanks for your review! |
The only problem is: if in the future stdlib needs new data from new variables, they have to be added to the object returned inside the |
What I would do instead is something like this; if (process.env.hasOwnProperty('STDLIB_ACCESS_TOKEN')) {
let prefix = 'STDLIB_';
return Object.keys(process.env)
.filter(key => key.indexOf(prefix) === 0)
.map(key => key.substr(prefix.length))
.reduce((obj, key) => {
obj[key] = process.env[prefix + key];
return obj;
}, {});
} That way you can add more variables in the future if necessary. If you make this change I can merge it. :) |
👍 |
I merged this, but we'll be updating the |
Great! I think And overwriting the same configuration with environment variables. |
From #40
It allows to use environment variables to replace variables from
.stdlib
.It's possible to set the
ACCESS_TOKEN
directly in an environment variable called ACCESS_TOKEN.