Documentation ¶
Index ¶
- Constants
- func WithFile(f string) func(*Config)
- func WithFs(fs afero.Fs) func(*Config)
- type Config
- func (c Config) GetBaseDir() string
- func (c Config) GetCacheDir() string
- func (c Config) GetConfigDir() string
- func (c Config) GetConfigFileUsed() string
- func (c Config) GetFs() afero.Fs
- func (c Config) GetInputFilename() string
- func (c Config) GetLanguage() string
- func (c Config) GetLogger() *slog.Logger
- func (c Config) GetToken() string
- type ConfigKey
- type ConfigurationReader
- type DownloadConfiguration
- type ExerciseConfiguration
Constants ¶
const ( ElfEnvPrefix string = "ELF" DefaultConfigFileBase string = "elf" DefaultConfigExt string = "toml" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (Config) GetBaseDir ¶
func (Config) GetCacheDir ¶
func (Config) GetConfigDir ¶
func (Config) GetConfigFileUsed ¶
GetConfigFileUsed returns the configuration file used.
If no configuration file is loaded, an empty string is returned. Failure to read a configuration file does not cause an error and will still result in an empty string.
func (Config) GetInputFilename ¶
func (Config) GetLanguage ¶
GetLanguage returns the configured default implementation language.
If no language is configured, an empty string is returned.
type ConfigKey ¶
type ConfigKey string
ConfigKey is a type for configuration keys.
const ( LanguageKey ConfigKey = "language" // Configuration key for the the default implementation language. ConfigDirKey ConfigKey = "config-dir" // Configuration key for application configuration files. CacheDirKey ConfigKey = "cache-dir" // Configuration key for cached application data. InputFileKey ConfigKey = "input-file" // InputFileKey is the configuration key for the default input file name. AdventTokenKey ConfigKey = "advent.token" // Configuration key for the Advent of Code auth token. AdventUserKey ConfigKey = "advent.user" // Configuration key for the Advent of Code user name. AdventDirKey ConfigKey = "advent.dir" // Configuration key for the Advent of Code exercise directory. EulerUserKey ConfigKey = "euler.user" // Configuration key for the Project Euler user name. EulerDirKey ConfigKey = "euler.dir" // Configuration key for Project Euler problem directory. )
type ConfigurationReader ¶
type ConfigurationReader interface { // GetConfigFileUsed returns the configuration file used. GetConfigFileUsed() string }
ConfigurationReader is an interface that defines methods for reading configuration.
type DownloadConfiguration ¶
type DownloadConfiguration interface { ExerciseConfiguration // GetCacheDir returns the directory where downloaded exercises are cached. GetCacheDir() string // GetConfigDir returns the configuration directory. GetConfigDir() string // GetInputFilename returns the input filename. GetInputFilename() string // GetToken returns the authentication token for downloading exercises. GetToken() string }
DownloadConfiguration is an interface that extends the ExerciseConfiguration interface. It represents the configuration for downloading exercises.
type ExerciseConfiguration ¶
type ExerciseConfiguration interface { // GetBaseDir returns the base directory. GetBaseDir() string // GetFs returns the file system. GetFs() afero.Fs // GetLanguage returns the language. GetLanguage() string // GetLogger returns the logger. GetLogger() *slog.Logger }
ExerciseConfiguration represents the interface for exercise configuration.