Browse Source

Run godep save

Andrea Fazzi 7 years ago
parent
commit
da1cfecf8a
2 changed files with 94 additions and 0 deletions
  1. 4 0
      Godeps/Godeps.json
  2. 90 0
      vendor/gogs.carducci-dante.gov.it/karmen/config/config.go

+ 4 - 0
Godeps/Godeps.json

@@ -60,6 +60,10 @@
 			"ImportPath": "github.com/jinzhu/inflection",
 			"ImportPath": "github.com/jinzhu/inflection",
 			"Rev": "1c35d901db3da928c72a72d8458480cc9ade058f"
 			"Rev": "1c35d901db3da928c72a72d8458480cc9ade058f"
 		},
 		},
+		{
+			"ImportPath": "gogs.carducci-dante.gov.it/karmen/config",
+			"Rev": "5443db3a69c5a3f2b87ae577344fcad8038935fe"
+		},
 		{
 		{
 			"ImportPath": "gogs.carducci-dante.gov.it/karmen/datasource",
 			"ImportPath": "gogs.carducci-dante.gov.it/karmen/datasource",
 			"Rev": "f9162fd685a41e50c8f148c8431d3bb18631fd6d"
 			"Rev": "f9162fd685a41e50c8f148c8431d3bb18631fd6d"

+ 90 - 0
vendor/gogs.carducci-dante.gov.it/karmen/config/config.go

@@ -0,0 +1,90 @@
+package config
+
+import (
+	"io/ioutil"
+
+	yaml "gopkg.in/yaml.v2"
+)
+
+const (
+	LOG_LEVEL_OFF = iota
+	LOG_LEVEL_INFO
+	LOG_LEVEL_DEBUG
+)
+
+type ConfigT struct {
+
+	// Domain
+
+	Domain string
+
+	// Logging
+
+	LogLevel int `yaml:"log_level"`
+
+	// Admin credentials
+
+	Admin struct {
+		Username string
+		Password string
+	}
+
+	// Database
+
+	Orm struct {
+		Connection  string
+		Options     string
+		Reset       bool
+		AutoMigrate bool
+		Regenerate  bool
+	}
+
+	// LDAP
+
+	Ldap struct {
+		Host         string
+		Port         string
+		BindPassword string `yaml:"bind_password"`
+		BindUser     string `yaml:"bind_user"`
+		RootDN       string `yaml:"root_dn"`
+
+		OuPeople        string `yaml:"ou_people"`
+		OuTeacher       string `yaml:"ou_teacher"`
+		OuGroup         string `yaml:"ou_group"`
+		OuTeachersGroup string `yaml:"ou_teachers_group"`
+	}
+
+	// LimeSurvey Remote Control URL
+
+	Limesurvey struct {
+		Url      string
+		Username string
+		Password string
+	}
+
+	// Cloud
+
+	Cloud struct {
+		Url      string
+		Username string
+		Password string
+	}
+}
+
+var Config *ConfigT
+
+func init() {
+	Config = new(ConfigT)
+}
+
+// Load loads the config file placed at the given path.
+func Load(path string, config *ConfigT) error {
+	cf, err := ioutil.ReadFile(path)
+	if err != nil {
+		return err
+	}
+	if err := yaml.Unmarshal(cf, config); err != nil {
+		return err
+	}
+	return nil
+}