move config
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
package models
 | 
			
		||||
package conf
 | 
			
		||||
 | 
			
		||||
import "sync"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								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" {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,11 @@ package models
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"oc-workflow/conf"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	c := GetConfig()
 | 
			
		||||
	c := conf.GetConfig()
 | 
			
		||||
	// configure storage
 | 
			
		||||
	fmt.Println(c.MongoUrl)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user