"strings"
"time"
- "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/api"
- "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/db"
+ "git.immae.eu/Cryptoportfolio/Front.git/api"
+ "git.immae.eu/Cryptoportfolio/Front.git/db"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/jloup/utils"
+ "github.com/wercker/journalhook"
)
var log = utils.StandardL().WithField("module", "api")
}
type ApiConfig struct {
- Domain string `toml:"domain"`
- JwtSecret string `toml:"jwt_secret"`
+ api.Config
}
type Config struct {
App AppConfig
Api ApiConfig
+ Mail api.MailConfig
Db db.DBConfig
Redis db.RedisConfig
App: AppConfig{
PublicDir: "./public",
},
- Api: ApiConfig{
- JwtSecret: "secret",
- },
}
c.LogConfiguration.SetToDefaults()
panic(err)
}
- api.SetJwtSecretKey(C.Api.JwtSecret)
-
- db.Init(C.Db, C.Redis)
-
- if C.Mode == "production" {
+ if C.Mode == "prod" {
+ gin.DisableConsoleColor()
gin.SetMode(gin.ReleaseMode)
+ journalhook.Enable()
}
+ api.SetConfig(C.Api.Config)
+ api.SetMailConfig(C.Mail)
+
+ db.Init(C.Db, C.Redis)
+
log.Infof("CONFIG:")
log.Infof("LISTEN: %s", strings.Join([]string{C.Address, C.Port}, ":"))
log.Infof("PUBLIC_DIR: %s", C.App.PublicDir)
engine.Use(gin.Recovery())
- if C.Mode == "production" {
+ if C.Mode == "prod" {
engine.Use(api.Logger())
apiGroup.Use(api.Logger())
} else {
"/",
"/signup",
"/signin",
+ "/confirm",
+ "/reset-password",
+ "/change-password",
"/signout",
"/me",
+ "/admin",
+ "/account",
"/otp/enroll",
"/otp/validate",
"/not_confirmed",