Skip to main content

NewAccessor

Creates a config accessor that implements Accessor interface and uses viper to load configs.

def NewAccessor(
opts: config.Options
) - > config.Accessor

Creates a config accessor that implements the Accessor interface and uses Viper to load configurations. Callers use this to obtain a configuration accessor for their application.

Parameters​

NameTypeDescription
optsconfig.OptionsConfiguration options to initialize the accessor, such as specifying the configuration file path or format.

Returns​

TypeDescription
config.AccessorAn object that implements the Accessor interface, providing methods to retrieve configuration values.