sparse-intern-71089
01/03/2022, 12:22 PMprehistoric-activity-61023
01/03/2022, 12:33 PMself._config.env_vars
look like?prehistoric-activity-61023
01/03/2022, 12:34 PMprehistoric-activity-61023
01/03/2022, 12:35 PM{"name": k, "value": str(v)} for k, v in self._config.env_vars.items()
prehistoric-activity-61023
01/03/2022, 12:35 PMv
can be easily converted using str(v)
)prehistoric-activity-61023
01/03/2022, 12:42 PMdebug: true
. I assume that environment
in container definition stands for environment variables (then it makes sense that they are parsed later as strings). If so, you have to properly convert this boolean value to string -> that depends on how your application handles it. Just remember if you use str(v)
, you’re gonna get upper-case versions:
>>> str(True)
'True'
>>> str(False)
'False'
If you want to fully control the conversion process, simply write a helper function that suits your needs:
def convert_to_env_string(v: Any) -> str:
if isinstance(v, str):
return v
if isinstance(v, bool):
return "true" if v else "false"
...
raise ValueError("unsupported type")
and use it later when creating map for environment field:
{"name": k, "value": convert_to_env_string(v)} for k, v in self._config.env_vars.items()
great-sunset-355
01/04/2022, 12:06 PMgreat-sunset-355
01/04/2022, 12:07 PMprehistoric-activity-61023
01/04/2022, 12:22 PMprehistoric-activity-61023
01/04/2022, 12:23 PMos.environ
in python) cause you cannot relay type information using them.great-sunset-355
01/04/2022, 12:26 PMinputs
that required JSON string
now accept python Dictonary
, hence the assumptionsprehistoric-activity-61023
01/04/2022, 1:38 PMcontainer_definitions
are supposed to be JSON strings and they actually could be python dicts
. However, your issue was related to the type of environment
field within that dictionary and I guess this part won’t change 🙂.