dstack
dstack copied to clipboard
Expose the service path prefix in a system environment variable
Problem
Some web apps require additional configuration to work with a path prefix.
Currently, it's not possible to write a single type: service configuration for such apps that would work in all environments:
- When a service is run without a gateway, its path prefix contains the project name, so it needs to be hardcoded in the configuration.
- When a service is run with a gateway, the path prefix isn't there, so it needs to be omitted from the configuration.
Solution
Add a new system environment variable that would contain the path prefix, e.g. DSTACK_SERVICE_PATH_PREFIX. When running with a gateway, the variable can contain /.
Workaround
Hardcode the path prefix depending on the project and the gateway.
Would you like to help us implement this feature by sending a PR?
Yes