Skip to content
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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions environment_variables_guide.md
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Environment variables are dynamically-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.

Copy link
Contributor

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!


## 1. Setting Environment Variables:

### On Linux/Mac

**Temporary (for the current session):**

```bash
export VARIABLE_NAME=value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example could be changed to one more topical to cargo mommy.

```

**Permanent (across sessions):**
Add the export command to your shell profile file (e.g., ~/.bashrc, ~/.zshrc).
Comment on lines +17 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo 'export VARIABLE_NAME=value' >> ~/.bashrc
echo 'export VARIABLE_NAME=value' >> ~/.bashrc

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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irrelevant.

Suggested change
## 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternately, consider a heading like

## 5. Consent Considerations: