checkId: check.core.env.variables plugin: stellaops.doctor.core severity: warn tags: [quick, environment, configuration]
Environment Variables
Doctor check
check.core.env.variables— for operators confirming a Stella Ops service knows which hosting environment it is running in, so it loads the right config and does not leak development settings into production.
What It Checks
Verifies that expected environment variables are configured for the runtime environment. The check looks for two recommended variables:
| Variable | Purpose |
|---|---|
ASPNETCORE_ENVIRONMENT | Sets the ASP.NET Core hosting environment (Development, Staging, Production) |
DOTNET_ENVIRONMENT | Sets the .NET hosting environment (fallback for non-ASP.NET hosts) |
The check also counts all platform-related environment variables matching these prefixes: STELLA*, ASPNETCORE*, DOTNET*, CONNECTIONSTRINGS*.
Result logic:
- If neither recommended variable is set but other platform variables exist (e.g.,
STELLAOPS_*,CONNECTIONSTRINGS__*), the check passes with a note that the environment defaults are being used. - If no platform variables at all are found, the check warns that the service may not be running in a configured deployment.
- If at least one recommended variable is set, the check passes and reports the current environment name and total platform variable count.
Why It Matters
The hosting environment controls which configuration files are loaded (appsettings.Development.json vs. appsettings.Production.json), whether developer exception pages are shown, and how logging is configured. Running in the wrong environment can expose detailed error information in production or apply development-only settings that degrade performance.
Common Causes
- No StellaOps, ASP.NET, or .NET environment variables found in the process
- The service is not running in a configured deployment (e.g., running directly without Docker or systemd)
- Docker compose
.envfile missing or not loaded - Environment variables defined in the wrong scope (host-level vs. container-level)
How to Fix
Docker Compose
Add the environment variable to your service in docker-compose.yml:
services:
platform:
environment:
ASPNETCORE_ENVIRONMENT: Production
Or in the .env file:
ASPNETCORE_ENVIRONMENT=Production
Bare Metal / systemd
Set the variable in the systemd unit file:
[Service]
Environment=ASPNETCORE_ENVIRONMENT=Production
Or export it in the shell:
export ASPNETCORE_ENVIRONMENT=Production
sudo systemctl restart stellaops-platform
Kubernetes / Helm
Set in Helm values:
env:
- name: ASPNETCORE_ENVIRONMENT
value: "Production"
Or in the pod spec directly:
kubectl set env deployment/stellaops-platform ASPNETCORE_ENVIRONMENT=Production
Verification
stella doctor run --check check.core.env.variables
Related Checks
check.core.config.loaded— verifies the configuration system is loaded (environment affects which config files load)check.core.config.required— verifies specific required settings are present
See the Doctor reference for the full check catalog, CLI usage, and export bundles.
