Browse Source

delete app dir

Paul 6 years ago
parent
commit
1a00ee78e8
3 changed files with 0 additions and 66 deletions
  1. 0
    40
      app/config.go
  2. 0
    14
      app/language.go
  3. 0
    12
      app/logger.go

+ 0
- 40
app/config.go View File

@@ -1,40 +0,0 @@
1
-package app
2
-
3
-import (
4
-	"path/filepath"
5
-	"strings"
6
-
7
-	"github.com/spf13/viper"
8
-)
9
-
10
-var (
11
-	Config appConfig
12
-)
13
-
14
-type appConfig struct {
15
-	DB struct {
16
-		Host               string `mapstructure:"host"`
17
-		Port               string `mapstructure:"port"`
18
-		User               string `mapstructure:"user"`
19
-		Password           string `mapstructure:"password"`
20
-		Name               string `mapstructure:"name"`
21
-		MaxIdleConnections int    `mapstructure:"max_idle_connections"`
22
-		MaxOpenConnections int    `mapstructure:"max_idle_connections"`
23
-	} `mapstructure:"db"`
24
-	Secret struct {
25
-		AuthKey string `mapstructure:"auth_key"`
26
-	} `mapstructure:"secret"`
27
-}
28
-
29
-func InitConfig(cfg string) {
30
-	viper.SetConfigFile(cfg)
31
-	viper.SetConfigType(strings.Trim(filepath.Ext(cfg), "."))
32
-
33
-	if err := viper.ReadInConfig(); err != nil {
34
-		panic(err)
35
-	}
36
-
37
-	if err := viper.Unmarshal(&Config); err != nil {
38
-		panic(err)
39
-	}
40
-}

+ 0
- 14
app/language.go View File

@@ -1,14 +0,0 @@
1
-package app
2
-
3
-import "github.com/Unknwon/i18n"
4
-
5
-func InitLang() {
6
-	languages := []string{"en-US", "zh-CN"}
7
-	for _, language := range languages {
8
-		if err := i18n.SetMessage(language, "languages/"+language+".ini"); err != nil {
9
-			panic(err)
10
-		}
11
-	}
12
-
13
-	i18n.SetDefaultLang("en-US")
14
-}

+ 0
- 12
app/logger.go View File

@@ -1,12 +0,0 @@
1
-package app
2
-
3
-import (
4
-	"github.com/gin-gonic/gin"
5
-	"github.com/sirupsen/logrus"
6
-)
7
-
8
-func InitLogger() {
9
-	if gin.Mode() == gin.DebugMode {
10
-		logrus.SetLevel(logrus.DebugLevel)
11
-	}
12
-}