Use env variables or not #3085
chentong319
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sometimes I was puzzled by the behavior of some execution or failed to reproduce something because of the hidden env variable. I am wondering whether we should use env variable. If yes, what are the general rules of using env variables in onnx-mlir project?
First of all, I asked someone. Here is the answer:
✅ When It's a Good Approach:
Configuration Outside of Code:
Environment variables allow you to control settings without changing code or configuration files. This makes deployment easier, especially in cloud environments (e.g., AWS, Heroku, Docker).
Sensitive Data Handling:
Ideal for credentials, API keys, and secrets since they aren't stored in code or version control.
Cross-Environment Flexibility:
Useful for configuring behavior across dev, staging, and production environments (e.g., switching databases, toggling debug modes).
Stateless Applications:
In containerized environments (like Docker or Kubernetes), environment variables help maintain statelessness by providing configuration at runtime.
❌ When It's Problematic:
Lack of Visibility:
If someone runs the program without knowing the necessary environment variables, they may encounter confusing errors.
Not Always Portable:
Moving the program between systems can be tricky if the required environment variables aren't documented or set correctly.
Security Risks:
If not managed carefully, sensitive data in environment variables can be exposed (e.g., via process lists or misconfigured shells).
Complexity in Large Projects:
Heavy reliance on environment variables can lead to "configuration sprawl," making it hard to manage and debug.
I tried to summarize all the uses of env variable in onnx-mlir:
What should we do about them and what is the guideline/plan for future?
Beta Was this translation helpful? Give feedback.
All reactions