Skip to content

Commit

Permalink
add config path setting
Browse files Browse the repository at this point in the history
  • Loading branch information
skye-z committed Mar 18, 2024
1 parent 8064671 commit a99f18a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
var page embed.FS

func main() {
util.InitConfig()
util.InitConfig(".")
router := service.InitRouter(page)
service.RunRouter(router)
}
4 changes: 2 additions & 2 deletions util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/spf13/viper"
)

func InitConfig() {
func InitConfig(path string) {
viper.SetConfigName("config")
viper.SetConfigType("ini")
viper.AddConfigPath(".")
viper.AddConfigPath(path)
err := viper.ReadInConfig()
if err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
Expand Down

0 comments on commit a99f18a

Please sign in to comment.