defang icon indicating copy to clipboard operation
defang copied to clipboard

defang config set values reset to .env file values when restart/redeploy (automatically)

Open GabrielLunesu opened this issue 2 months ago • 0 comments

Describe the issue

Environment variables set via defang config set are being overridden by values from the local .env file after approximately 1 hour, or on service restart/redeploy.

Repo steps

Create .env file with: META_OAUTH_REDIRECT_URI=http://old-url/callback Set production value: defang config set META_OAUTH_REDIRECT_URI "https://new-url/callback" Deploy: defang compose up Verify the new value is being used (works correctly) Wait ~1 hour or trigger a redeploy Application now uses the old value from .env file

Expected results

When using defang config set KEY "value", the runtime configuration should persist and take precedence over .env file values across restarts and redeployments.

Actual results

Set production value: defang config set META_OAUTH_REDIRECT_URI "https://prod-url/callback" Value works correctly initially After ~1 hour (or on restart), the value reverts to the one defined in local .env file This causes OAuth callbacks to fail as they point to old/incorrect URLs

Additional notes

Workaround Either:

Update values in .env file to match production (defeats purpose of config management)

Remove .env from build context entirely (inconvenient for development)

Expected Resolution Runtime config values from defang config set should always take precedence over .env files, or .env files should not be included in the production deployment at all.

GabrielLunesu avatar Nov 18 '25 18:11 GabrielLunesu