Преглед изворни кода

Fix import of config package

Andrea Fazzi пре 7 година
родитељ
комит
fd67dcc78a
5 измењених фајлова са 4 додато и 94 уклоњено
  1. 1 1
      api/login.go
  2. 0 90
      config/config.go
  3. 1 1
      main.go
  4. 1 1
      renderer/renderer.go
  5. 1 1
      vendor/gogs.carducci-dante.gov.it/karmen/orm/teacher.go

+ 1 - 1
api/login.go

@@ -7,7 +7,7 @@ import (
 	"time"
 
 	jwt "github.com/dgrijalva/jwt-go"
-	"gogs.carducci-dante.gov.it/karmen/core/config"
+	"gogs.carducci-dante.gov.it/karmen/config"
 	"gogs.carducci-dante.gov.it/karmen/core/renderer"
 )
 

+ 0 - 90
config/config.go

@@ -1,90 +0,0 @@
-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
-}

+ 1 - 1
main.go

@@ -9,8 +9,8 @@ import (
 	"github.com/gorilla/handlers"
 	"github.com/jinzhu/gorm"
 
+	"gogs.carducci-dante.gov.it/karmen/config"
 	"gogs.carducci-dante.gov.it/karmen/core/api"
-	"gogs.carducci-dante.gov.it/karmen/core/config"
 	"gogs.carducci-dante.gov.it/karmen/core/renderer"
 	"gogs.carducci-dante.gov.it/karmen/orm"
 )

+ 1 - 1
renderer/renderer.go

@@ -11,7 +11,7 @@ import (
 	"path/filepath"
 	"strings"
 
-	"gogs.carducci-dante.gov.it/karmen/core/config"
+	"gogs.carducci-dante.gov.it/karmen/config"
 )
 
 var currRenderer Renderer

+ 1 - 1
vendor/gogs.carducci-dante.gov.it/karmen/orm/teacher.go

@@ -5,7 +5,7 @@ import (
 	"fmt"
 
 	"github.com/jinzhu/gorm"
-	"gogs.carducci-dante.gov.it/karmen/core/config"
+	"gogs.carducci-dante.gov.it/karmen/config"
 )
 
 type Teacher struct {