-
Notifications
You must be signed in to change notification settings - Fork 52
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
add env-vars documentation #42
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,89 @@ | ||||||||||||||||||||||||
# Environment Variables and rcfiles Guide | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## Environment Variables Overview | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Environment variables are dynamic-named values that affect the processes running on an operating system. They are used to store configuration settings, paths, and other important information. Here's a step-by-step guide on how to work with environment variables. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## 1. Setting Environment Variables: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
### On Linux/Mac | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
**Temporary (for the current session):** | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||
export VARIABLE_NAME=value | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example could be changed to one more topical to |
||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
**Permanent (across sessions):** | ||||||||||||||||||||||||
Add the export command to your shell profile file (e.g., ~/.bashrc, ~/.zshrc). | ||||||||||||||||||||||||
Comment on lines
+17
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't explain why it makes this change permanent. |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||
echo 'export VARIABLE_NAME=value' >> ~/.bashrc | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
ditto. |
||||||||||||||||||||||||
source ~/.bashrc | ||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
### On Windows | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
**Temporary (for the current session):** | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```powershell | ||||||||||||||||||||||||
$env:VARIABLE_NAME = "value" | ||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
**Permanent (across sessions):** | ||||||||||||||||||||||||
Use the System Properties window to set user or system environment variables. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## 2. Using Environment Variables in rcfiles: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
### Example: Bash Shell (~/.bashrc or ~/.bash_profile) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||
# Example: Adding a custom directory to the PATH | ||||||||||||||||||||||||
export PATH=$PATH:/path/to/custom/directory | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Example: Setting a default editor | ||||||||||||||||||||||||
export EDITOR=vim | ||||||||||||||||||||||||
Comment on lines
+41
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto. |
||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
### Example: PowerShell Profile ($PROFILE) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```powershell | ||||||||||||||||||||||||
# Example: Adding a custom directory to the PATH | ||||||||||||||||||||||||
$env:PATH += ";C:\path\to\custom\directory" | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Example: Setting a default editor | ||||||||||||||||||||||||
$env:EDITOR = "notepad.exe" | ||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## 3. Common Configurations: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
### Node.js Development | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||
export NODE_ENV=development | ||||||||||||||||||||||||
export PORT=3000 | ||||||||||||||||||||||||
Comment on lines
+63
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto. |
||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
### Python Development | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||
export PYTHONPATH=/path/to/project | ||||||||||||||||||||||||
export FLASK_ENV=development | ||||||||||||||||||||||||
Comment on lines
+70
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto. |
||||||||||||||||||||||||
``` | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## 4. Windows Considerations: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
**On Windows, environment variables can be set through the System Properties or using PowerShell.** | ||||||||||||||||||||||||
**To persistently modify environment variables on Windows, use the [System Properties](https://www.computerhope.com/issues/ch000549.htm) window. This requires administrative privileges.** | ||||||||||||||||||||||||
Comment on lines
+74
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should explain the persistence of PowerShell's env vars instead. |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
## 5. Security Considerations: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
**Avoid storing sensitive information directly in environment variables.** | ||||||||||||||||||||||||
**On Windows, be cautious about using environment variables in scripts as they can be easily accessed.** | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
## 6. Best Practices: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
**Use uppercase letters and underscores for variable names (e.g., DATABASE_URL).** | ||||||||||||||||||||||||
**Document your environment variables in a README file for better collaboration.** | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
By following these steps and examples, you can effectively manage and use environment variables in various scenarios, making your development environment more flexible and scalable. | ||||||||||||||||||||||||
Comment on lines
+79
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Irrelevant.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternately, consider a heading like ## 5. Consent Considerations: |
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.
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.
However, in general, these docs don't need to explain this in a general way. Mommy needs an explanation for
cargo mommy
in particular!