From 6b34be6508022ba88177e9194cf2712e163fc159 Mon Sep 17 00:00:00 2001 From: ycc Date: Thu, 11 Jul 2024 15:40:34 +0200 Subject: [PATCH] move config --- {models => conf}/config.go | 2 +- main.go | 8 ++++---- models/workflow.go | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) rename {models => conf}/config.go (94%) diff --git a/models/config.go b/conf/config.go similarity index 94% rename from models/config.go rename to conf/config.go index 5296ffb..76a262f 100644 --- a/models/config.go +++ b/conf/config.go @@ -1,4 +1,4 @@ -package models +package conf import "sync" diff --git a/main.go b/main.go index e5d2703..76b70b6 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "oc-workflow/models" + "oc-workflow/conf" _ "oc-workflow/routers" "github.com/beego/beego/logs" @@ -40,9 +40,9 @@ func main() { o = onion.New(l1, l3) } - models.GetConfig().MongoUrl = o.GetStringDefault("mongourl", "http://localhost:4080") - models.GetConfig().MongoLogin = o.GetStringDefault("mongologin", "admin") - models.GetConfig().MongoPassword = o.GetStringDefault("mongopassword", "admin") + conf.GetConfig().MongoUrl = o.GetStringDefault("mongourl", "http://localhost:4080") + conf.GetConfig().MongoLogin = o.GetStringDefault("mongologin", "admin") + conf.GetConfig().MongoPassword = o.GetStringDefault("mongopassword", "admin") // Normal beego init //if beego.BConfig.RunMode == "dev" { diff --git a/models/workflow.go b/models/workflow.go index bc579aa..4774c8e 100644 --- a/models/workflow.go +++ b/models/workflow.go @@ -2,10 +2,11 @@ package models import ( "fmt" + "oc-workflow/conf" ) func init() { - c := GetConfig() + c := conf.GetConfig() // configure storage fmt.Println(c.MongoUrl) }