-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from restechnica/feature/multiple-default-conf…
…ig-file-names feature/multiple-default-config-file-names
- Loading branch information
Showing
8 changed files
with
85 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ major = ["release"] | |
delimiters = "/" | ||
|
||
[modes.git-commit] | ||
delimiters = "[]" | ||
delimiters = "[]/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ldflags | ||
|
||
// -X key=value ldflags definitions, injected at build time. | ||
var ( | ||
// Version The release version of the sbot binary. | ||
Version string = "dev" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package viperx | ||
|
||
import ( | ||
"path/filepath" | ||
"strings" | ||
|
||
"github.com/rs/zerolog/log" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
// LoadConfig loads a configuration file. | ||
// Returns an error if it fails. | ||
func LoadConfig(path string) (err error) { | ||
viper.AddConfigPath(filepath.Dir(path)) | ||
viper.SetConfigName(strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))) | ||
viper.SetConfigType(strings.Split(filepath.Ext(path), ".")[1]) | ||
|
||
log.Debug().Str("path", path).Msg("loading config file...") | ||
|
||
return viper.ReadInConfig() | ||
} |