diff options
author | 2023-08-26 16:37:28 +0200 | |
---|---|---|
committer | 2023-08-26 16:37:28 +0200 | |
commit | c18abf8a8b7ed484036bbe936893be6e1665f037 (patch) | |
tree | 58464ba1f46d6d25005bfb5de2c23a5b437e900c | |
parent | pass bot to get_or_fetch_channel in thread bumper (#2732) (diff) | |
parent | feat(tags): update link and syntax in dotenv tag (diff) |
Merge pull request #2730 from DownDev/fix-2728
fix(tags): resolve SyntaxError in `!dotenv` command
-rw-r--r-- | bot/resources/tags/dotenv.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bot/resources/tags/dotenv.md b/bot/resources/tags/dotenv.md index 14fff3458..b1dc57fa5 100644 --- a/bot/resources/tags/dotenv.md +++ b/bot/resources/tags/dotenv.md @@ -6,20 +6,20 @@ embed: Dotenv files are especially suited for storing secrets as they are a key-value store in a file, which can be easily loaded in most programming languages and ignored by version control systems like Git with a single entry in a `.gitignore` file. -In python you can use dotenv files with the [`python-dotenv`](https://pypi.org/project/python-dotenv) module from PyPI, which can be installed with `pip install python-dotenv`. To use dotenv files you'll first need a file called `.env`, with content such as the following: +In Python you can use dotenv files with the [`python-dotenv`](https://pypi.org/project/python-dotenv) module from PyPI, which can be installed with `pip install python-dotenv`. To use dotenv files you'll first need a file called `.env`, with content such as the following: ``` TOKEN=a00418c85bff087b49f23923efe40aa5 ``` Next, in your main Python file, you need to load the environment variables from the dotenv file you just created: ```py -from dotenv import load_dotenv() +from dotenv import load_dotenv -load_dotenv(".env") +load_dotenv() ``` -The variables from the file have now been loaded into your programs environment, and you can access them using `os.getenv()` anywhere in your program, like this: +The variables from the file have now been loaded into your program's environment, and you can access them using `os.getenv()` anywhere in your program, like this: ```py from os import getenv my_token = getenv("TOKEN") ``` -For further reading about tokens and secrets, please read [this explanation](https://vcokltfre.dev/tips/tokens). +For further reading about tokens and secrets, please read [this explanation](https://tutorial.vco.sh/tips/tokens/). |