Hi, I’m deploying a service which receives an environment variable which has a string value that contains ${routedByValue}. This ${routedByValue} represents a string - I don’t want it be replaced with an env var.
I tried to use double dollar sign ($$) but failed, also tried escaping with \ - didn’t work as well.
A quick workaround for this could be to escape the envsubst that okteto does internally. Here’s a post with all kinds of different methods, but I think the most appropiate in this case is to write your envvar as
\$\${non_existent_envvar}{routedByValue}
I know it’s not the most elegant, but it should do the work.
May I ask what’s the use case here? Why does the CONNECTOR_CONFIG gets injected partially with ${routedByValue} unset for later?
I also tried the Dollar trick, by adding another environment DOLLAR=$, but it didn’t work as well since ${DOLLAR} is not being replaced with $`.
Regarding your question - this docker is setting up Debezium which uses this config, this variable is listed here: Outbox Event Router :: Debezium Documentation. I admin that I don’t know much more to elaborate, I’m just trying to setup the environment based on our config in production and locally pre-Okteto time.
The workaround of .env does work, however my concern with this approach is that this service is used by many other services as a dependency, so when a dev runs okteto deploy of another service, this .env file won’t be available during the deploy. Another issue is that we use .env in .gitignore so I can’t commit this file for everyone (I can create another parallel committed file though).
I tried to set the variable in a config file and reference the file with env_file:, but it didn’t help either - the env was replaced with an empty string.
Hello @hadaromash ! it looks like we need to work on it. As of today, it is not possible to escape an environment variable with the same approach that docker follows. I have created an issue with it and after addressing it we should be able to solve scenarios like yours. Thank you very much for discovering it!
Hey @hadaromash ! Thanks a lot for your patience and for discovering this unexpected functionality.
While debugging this, I’ve seen that we do the envsubst multiple times, and that’s causing the issue. While we work on the fix, I’ve found a solution to your current use case! Try using
$$$$${doesntexist}{routedByValue}
It has worked for me just now. Tell me how did it go
I was doing some testing to deploy services for my university and I discover that you can’t add a variable with special characters using the launch environment from the dashboard.
If you do that, you receive deploy command failed: exit status 1 in the console.
Example:
mongodb+srv://usr:password@host/db?retryWrites=true&w=majority => exit status 1
mongodb+srv://usr:password@host/db => works.
Do you know is there any workaround for this?
Thanks in advance