Documentation ¶
Index ¶
- func BuildViper(profile string, dirs *CommonDirs, s3Profile model.S3Profile) *viper.Viper
- func GetBaseFolder() string
- func GetConfigFileName() string
- func GetConfigProfile() string
- func GetDataFolder() string
- func InitializeViper() (*viper.Viper, error)
- func S3ProfileFromConfig(profile string) model.S3Profile
- func S3ProfileFromCtx(c *cli.Context) model.S3Profile
- func UpdateS3Config(s3Profile model.S3Profile, dirs *CommonDirs) error
- type CommonDirs
- type ConfKeyMap
- type ConfKeys
- type ConfigurationBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildViper ¶
func GetBaseFolder ¶
func GetBaseFolder() string
GetBaseFolder returns the base folder for the application which contains the config file and all data
func GetConfigFileName ¶
func GetConfigFileName() string
GetConfigFileName Currently just returns default allow this to be configurable
func GetConfigProfile ¶
func GetConfigProfile() string
GetConfigProfile Currently just returns default
func GetDataFolder ¶
func GetDataFolder() string
GetDataFolder returns the data folder for the application which contains
func InitializeViper ¶
func S3ProfileFromConfig ¶
func S3ProfileFromCtx ¶
func UpdateS3Config ¶
func UpdateS3Config(s3Profile model.S3Profile, dirs *CommonDirs) error
Types ¶
type CommonDirs ¶
type CommonDirs struct { BaseFolder string DataFolder string S3Folder string DisclosuresFolder string ImageFolder string OcrFolder string CsvFolder string }
func NewCommonDirs ¶
func NewCommonDirs(baseFolder string) *CommonDirs
NewCommonDirs TODO - allow these to be changed
func NewCommonDirsFromCtx ¶
func NewCommonDirsFromCtx(c *cli.Context) *CommonDirs
func (*CommonDirs) CreateDirectories ¶
func (c *CommonDirs) CreateDirectories() error
func (*CommonDirs) ToString ¶
func (c *CommonDirs) ToString() string
type ConfKeyMap ¶
type ConfKeyMap struct {
// contains filtered or unexported fields
}
ConfKeyMap is a struct that holds the configuration key for a single folder of the application
func (*ConfKeyMap) GetConfigKey ¶
func (c *ConfKeyMap) GetConfigKey() string
GetConfigKey returns the viper configuration key
func (*ConfKeyMap) GetContextKey ¶
func (c *ConfKeyMap) GetContextKey() string
GetContextKey returns the urfave CLI context key
func (*ConfKeyMap) GetCurrentVal ¶
func (c *ConfKeyMap) GetCurrentVal() string
GetCurrentVal returns the current value for the folder
func (*ConfKeyMap) GetDefaultVal ¶
func (c *ConfKeyMap) GetDefaultVal() string
GetDefaultVal returns the default value for the folder
func (*ConfKeyMap) SetViperValue ¶
func (c *ConfKeyMap) SetViperValue(v *viper.Viper)
SetViperValue sets the current value for the folder to Viper
type ConfKeys ¶
type ConfKeys struct {
// contains filtered or unexported fields
}
ConfKeys is a struct that holds the configuration keys for the main folders of the application
func BuildConfKeyMaps ¶
BuildConfKeyMaps builds the configuration keys for the main folders
func (*ConfKeys) GetCommonDirs ¶
func (c *ConfKeys) GetCommonDirs() *CommonDirs
GetCommonDirs creates a new CommonDirs object for use in commands
func (*ConfKeys) GetFolders ¶
GetFolders returns a list of folders to be created
func (*ConfKeys) GetKeyMap ¶
func (c *ConfKeys) GetKeyMap(ctxKey string) *ConfKeyMap
GetKeyMap returns the configuration key for a single folder based on the key used to set the value in the CLI
type ConfigurationBuilder ¶
type ConfigurationBuilder struct {
// contains filtered or unexported fields
}
ConfigurationBuilder is used to build the configuration object on application startup. This is responsible for creating the initial configuration directories and files, then building the configuration object from the context and any existing configuration.
func NewConfigurationBuilder ¶
func NewConfigurationBuilder(profile string, ctx *cli.Context) (*ConfigurationBuilder, error)
NewConfigurationBuilder creates a new configuration builder used to configure the CommonDirs object for use within various commands
func (*ConfigurationBuilder) Build ¶
func (c *ConfigurationBuilder) Build() error
Build Creates directories and builds the configuration object
func (*ConfigurationBuilder) GetCommonDirs ¶
func (c *ConfigurationBuilder) GetCommonDirs() *CommonDirs
GetCommonDirs wraps ConfKeys GetCommonDirs method