-
Notifications
You must be signed in to change notification settings - Fork 335
Environment variable for global API key #209
Comments
Might be wrong but I don't think it's actually implemented. |
it is possible but you are right to indicate that it is not documented! https://github.com/cloudflare/wrangler/blob/master/src/settings/global_user.rs#L28 it is also untested- we should document and test this to make it better/possible to use. |
@DrDaveD @ashleygwilliams I just submitted a PR (#225) to remove the hard-requirements for a global config file, so @DrDaveD The correct envs are The code comments in |
Thanks! I confirm that not setting api_key in the config file and instead exporting CF_API_KEY works. |
Example of how to use env vars like CF_API_KEY inside |
hi @paulbhartzog-holo ! I'm curious why you'd want to use the environment variables inside the wrangler.toml. A wrangler.toml file should only contain information that you'd want to commit to source control, which means that it should not be potentially accessible to the public. As a result, we don't allow anyone to configure their global API key in the configuration file because your API key is not something that should every be publicly shared. An environment variable is an key value pair available in your environment- storing an env variable in a config file is possible in a few systems (with an encryption CLI feature) but we prefer to ask folks to configure it using
Would any of the above solutions help or could you share more about why you'd like to have this data in your wrangler.toml? Would love to help! |
Didn't end up needing ENV vars in toml. We are integrating CircleCI, and their env-vars worked great. :-) |
closed by #379. Also opened an issue in the docs repo (cloudflare/cloudflare-docs#327) for updating the quick start. good catch! |
@ashleygwilliams is the implicit assumption here that only the global API key is a secret and that account IDs and zone IDs are OK to be public?
|
@wuservices correct! as per our security team, it's completely Fine to have your zone_id and account_id public, the Global API key and associated email address should be kept secret. everything in a wrangler.toml is committable to publicly accessible version control :) |
How about |
The bottom of the API keys documentation page says to use environment variables if possible for the important key but doesn't explain how to do it. Checking the code, I don't see any way to do it. Is there a way? If not, could you please make a way or at a minimum remove the suggestion from the documentation?
The text was updated successfully, but these errors were encountered: