I am working through an example in GitHub.jl right now and trying to get user auth set up so that I can send API requests. One of the examples suggests doing ENV["GITHUB_AUTH"] instead of hard coding your API token however I am not sure how to define a variable like this. I tried looking for a usage example in help mode but it yielded the following with no example:
ENV
Reference to the singleton EnvDict, providing a dictionary interface to system environment variables.
(On Windows, system environment variables are case-insensitive, and ENV correspondingly converts all keys
to uppercase for display, iteration, and copying. Portable code should not rely on the ability to
distinguish variables by case, and should beware that setting an ostensibly lowercase variable may result
in an uppercase ENV key.)
As it turns out, setting up an ENV variable is as simple as:
ENV["GITHUB_AUTH"] = "my API key"
where "GITHUB_AUTH" is the name of the ENV variable you want to create.
If you want to read more about the limitations and proper use of ENV variables, you can check out the Julia docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With