I'm working on a Bash script that incorporates environment variables from ConfigMaps and Secrets, and I'm wondering if I should standardize the naming conventions for these variables. Right now, my naming is a bit all over the place. For instance, I have variables from Secrets using camelCase and those from ConfigMaps in UPPER_SNAKE_CASE. Here's how it looks:
```bash
# secret - camelCase
export AWS_ACCESS_KEY_ID="${awsAccessKeyId:-}"
export AWS_SECRET_ACCESS_KEY="${awsSecretAccessKey:-}"
export RESTIC_PASSWORD="${resticPassword:-}"
# configmap - UPPER_SNAKE_CASE
export RESTIC_REPOSITORY="${RESTIC_REPOSITORY:-}"
```
Should I unify these styles for better clarity?
4 Answers
I actually have a convention where I only use Secrets for environment variables and keep ConfigMaps for mounted files. It simplifies things a lot for developers, as they often mix them otherwise. I find it easier to manage, especially when you have external secrets involved!
I also recommend keeping it consistent with UPPER_SNAKE_CASE. It makes everything look uniform, and it's easier for anyone else reading your code to understand. Plus, it looks more professional!
Honestly, it doesn't matter as long as it works! But if you're looking for clarity and ease of use for others, standardizing makes sense.
It's generally a good idea to stick with a consistent naming style across your project. Using uppercase snake case for both Secrets and ConfigMaps can reduce confusion. You can import the environment variables directly from them without extra mapping, which simplifies your deployment configuration too.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically