Add config & docker deployment

This commit is contained in:
ycc
2023-03-09 11:45:29 +01:00
parent 24fd211a43
commit acd9b1611c
7 changed files with 114 additions and 3 deletions

23
models/config.go Normal file
View File

@@ -0,0 +1,23 @@
package models
import "sync"
type Config struct {
ZincUrl string
ZincLogin string
ZincPassword string
RedisUrl string
RedisPassword string
IdentityFile string
Defaultpeers string
}
var instance *Config
var once sync.Once
func GetConfig() *Config {
once.Do(func() {
instance = &Config{}
})
return instance
}

View File

@@ -37,6 +37,8 @@ type Peer struct {
}
func init() {
c := GetConfig()
Store = Storage{c.ZincUrl, c.ZincLogin, c.ZincPassword, c.RedisUrl, c.RedisPassword}
Store = Storage{"http://localhost:4080", "admin", "admin", "localhost:6379", ""}
//p := Peer{uuid.New().String(), 0, []string{"car", "highway", "images", "video"}, time.Now(), "1", "asf", ""}
// pa := []Peer{p}