Fixed lint issues and missing documentation
This commit is contained in:
1 parent
7fd321df97
commit
6e6dec68c0
34 files changed
+346
-156
No files matched your search
@@ -9,7 +9,8 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// Reads in dotenv file for configuration
|
||||
// loadEnv loads environment variables from a .env file in the working
|
||||
// directory.
|
||||
func loadEnv() error {
|
||||
if err := godotenv.Load(); err != nil {
|
||||
return fmt.Errorf("invalid .env file: %w", err)
|
||||
@@ -17,7 +18,9 @@ func loadEnv() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reads in config file and ENV variables if set to form a configuration.
|
||||
// loadConfig sets up Viper with the defaults, cfgFile (or config.* found in
|
||||
// EtcConfigPath or the working directory) and JOBSEARCH_* environment
|
||||
// variables. A missing config file is only a warning.
|
||||
func loadConfig(cfgFile string) error {
|
||||
if cfgFile != "" {
|
||||
// Use config file from the flag.
|
||||
@@ -54,7 +57,9 @@ func loadConfig(cfgFile string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Initilises environment file configuration and general app configuration
|
||||
// Init loads the .env file and the configuration (see loadConfig) into conf.
|
||||
// A debug or error log level already set in conf, from --debug or --quiet,
|
||||
// is kept over the loaded one.
|
||||
func Init(cfgFile string, conf *JobSearchConfig) error {
|
||||
if err := loadEnv(); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user