restate icon indicating copy to clipboard operation
restate copied to clipboard

Check how to set a configuration value to null via env variables

Open tillrohrmann opened this issue 2 years ago • 5 comments

Currently, it is not clear how one can set a nullable configuration value to null via env variables. See https://github.com/restatedev/restate/pull/467 for more details.

tillrohrmann avatar May 31 '23 21:05 tillrohrmann

Seems like this is an upstream bug https://github.com/SergioBenitez/Figment/issues/78. I have posted a patch there, if the mantainer doesn't like it we can apply it only downstream

slinkydeveloper avatar Jul 19 '23 15:07 slinkydeveloper

I think we can solve the problem by using #[serde_as(as = "serde_with::NoneAsEmptyString")] for Option<T> fields. Then one can set the field to None by specifying an empty string value.

tillrohrmann avatar Jan 11 '24 18:01 tillrohrmann

@AhmedSoliman any chance you tried to do this with the new configurations?

slinkydeveloper avatar Apr 23 '24 12:04 slinkydeveloper

What are we trying to achieve here? We shouldn't have configuration keys where null is a valid value, at least, that's true in the new configuration. TOML doesn't support nulls to start with.

The only way to use the default value is to "not set" it from env or config file, then the default will apply, but you can't "unset" from higher layers, effectively.

AhmedSoliman avatar Apr 24 '24 07:04 AhmedSoliman

@AhmedSoliman is it possible to "unset" a default value that is set? The example in question was the num_timers_in_memory_limit used by the timer service, which by default is set but one might also want to unset it.

slinkydeveloper avatar Apr 24 '24 10:04 slinkydeveloper