platform icon indicating copy to clipboard operation
platform copied to clipboard

opentdf.yaml has case sensitive keys

Open pflynn-virtru opened this issue 1 year ago • 5 comments

OpenTDF uses Viper has its configuration library. One limitation is Viper does NOT support case sensitive keys, see https://github.com/spf13/viper?tab=readme-ov-file#does-viper-support-case-sensitive-keys

Expected: all lower-case keys for configuration.

Example of problem, enforcDPoP. Various cases of the key is seen in the logs:

Screenshot 2024-05-02 at 3 35 21 PM Screenshot 2024-05-02 at 3 32 39 PM

Note Viper doesn't support special characters like - or _ in keys.

pflynn-virtru avatar May 06 '24 16:05 pflynn-virtru

@pflynn-virtru Viper should support -, _. Where are you seeing this?

Also the reason you see the case differences is because that log statement is just dumping the struct.

https://github.com/opentdf/platform/blob/859ad2c7f649f7424007b3937c5b1a745220a9cb/service/pkg/server/start.go#L47

Are you seeing issues in the config files?

strantalis avatar May 07 '24 11:05 strantalis

Since Viper supports ENV vars I would suggest using _ otherwise you'll have env vars like ENFORCEDPOP=true opentdf start. Most *nix envs tend to use vars like ENFORCE_DPOP=true

jrschumacher avatar May 07 '24 20:05 jrschumacher

The env variables will be the full path joined by underscores.

dmihalcik-virtru avatar May 30 '24 19:05 dmihalcik-virtru

I think we should bump this up in priority as it caused https://github.com/opentdf/platform/issues/890 and I believe it has caused others (though I can't recall issue names/numbers).

jakedoublev avatar May 30 '24 19:05 jakedoublev

in the future, when adding new configuration variables to the opentdf-example.yaml, contributors should use lower snake case. This issue is low priority, to edit the .yaml to comply to this.

cassandrabailey293 avatar Jun 06 '24 16:06 cassandrabailey293