๐น @env Operator in TuskLang - Go Guide
@env Operator in TuskLang - Go Guide
๐ฑ Environment Variables, Supercharged
TuskLangโs @env operator is the ultimate bridge between your environment and your config. We donโt bow to any kingโnot even .env files. Hereโs how to use @env in Go projects for secure, dynamic configuration.
๐ Table of Contents
- What is @env? - Basic Usage - Default Values - Security Considerations - Go Integration - Best Practices๐งฌ What is @env?
The @env operator injects environment variables directly into your config. No more static secrets or hardcoded valuesโjust pure, dynamic power.
๐ ๏ธ Basic Usage
[api]
api_key: @env("API_KEY")๐ช Default Values
[api]
timeout: @env("API_TIMEOUT", 30)๐ Security Considerations
- Use@env.secure for sensitive values
- Never commit secrets to version control
- Validate all required env vars at startup๐ Go Integration
apiKey := config.GetString("api_key") // Loads from @envManual Fallback
val := os.Getenv("API_KEY")
if val == "" { val = "default" }๐ฅ Best Practices
- Use@env for all environment-driven config
- Always provide a default value
- Validate presence of critical env vars---
TuskLang: No .env files. No leaks. Just pure environment power.