Summary
When a Docker Compose file defines environment variables using standard fallback/passthrough syntax (such as MY_VAR: ${MY_VAR:-} or MY_VAR: ${MY_VAR}), Openship imports this into the service's environment definition with an empty string value ("").
At container runtime, service-level environment variables take precedence over project-level environment variables. Because the service table holds MY_VAR: "", it overrides any non-empty value configured in the Project Settings with an empty string.
Steps to Reproduce
- In a compose file (
docker-compose.yml), configure a service with a passthrough environment variable:
services:
web:
image: my-image:latest
environment:
CONFIG_PARAM: ${CONFIG_PARAM:-}
- In Openship Project Settings, add
CONFIG_PARAM=my-production-value.
- Deploy the project.
- Inspect the running container environment (
printenv CONFIG_PARAM inside the container).
Expected Behavior
The container should receive CONFIG_PARAM=my-production-value from the project environment variables.
Actual Behavior
The container receives CONFIG_PARAM="" (empty string) because the service-level imported spec sets CONFIG_PARAM: "", which clobbers the project-level environment variable.
Suggested Resolution
- When importing compose environment variables, do not store unpopulated placeholder fallbacks as explicit service-level overrides.
- Alternatively, during compose parsing, interpolate project-level environment variables into
${VAR} references, or treat empty service-level defaults as fallback to project-level variables during the merge step.
Summary
When a Docker Compose file defines environment variables using standard fallback/passthrough syntax (such as
MY_VAR: ${MY_VAR:-}orMY_VAR: ${MY_VAR}), Openship imports this into the service'senvironmentdefinition with an empty string value ("").At container runtime, service-level environment variables take precedence over project-level environment variables. Because the service table holds
MY_VAR: "", it overrides any non-empty value configured in the Project Settings with an empty string.Steps to Reproduce
docker-compose.yml), configure a service with a passthrough environment variable:CONFIG_PARAM=my-production-value.printenv CONFIG_PARAMinside the container).Expected Behavior
The container should receive
CONFIG_PARAM=my-production-valuefrom the project environment variables.Actual Behavior
The container receives
CONFIG_PARAM=""(empty string) because the service-level imported spec setsCONFIG_PARAM: "", which clobbers the project-level environment variable.Suggested Resolution
${VAR}references, or treat empty service-level defaults as fallback to project-level variables during the merge step.