Closed capri-xiyue closed 2 years ago
There are some duplicates when loading config from env, do validation and set defaults. https://github.com/abcxyz/jvs/blob/main/pkg/config/public_key_config.go#L43 and https://github.com/abcxyz/jvs/blob/23cdda185a8fc277ba798bfaf3e34543458f1934/pkg/config/crypto_config.go#L102.
We can do refactor to avoid duplicates.
Create a common function which handles loading config from env with any parameter. The caller of the common function need to pass the pointer of specific config like PublicKeyConfig or CryptoConfig as the value of any parameter.
any
PublicKeyConfig
CryptoConfig
No response
Added a lib in pkg: https://github.com/abcxyz/pkg/pull/33
Adopt pkg/cfgloader wherever applicable
TL;DR
There are some duplicates when loading config from env, do validation and set defaults. https://github.com/abcxyz/jvs/blob/main/pkg/config/public_key_config.go#L43 and https://github.com/abcxyz/jvs/blob/23cdda185a8fc277ba798bfaf3e34543458f1934/pkg/config/crypto_config.go#L102.
We can do refactor to avoid duplicates.
Detailed design
Create a common function which handles loading config from env with
any
parameter. The caller of the common function need to pass the pointer of specific config likePublicKeyConfig
orCryptoConfig
as the value ofany
parameter.Alternatives considered
No response
Additional information
No response