update config
This commit is contained in:
parent
3422f450f1
commit
f305bc6ce6
13
.env.example
13
.env.example
@ -1,8 +1,17 @@
|
|||||||
|
HTTP_LISTEN_ADDR=127.0.0.1:8080
|
||||||
|
GRPC_LISTEN_ADDR=
|
||||||
|
|
||||||
DB_DSN=
|
DB_DSN=
|
||||||
REDIS_ADDR=
|
REDIS_ADDR=
|
||||||
REDIS_PASS=
|
REDIS_PASS=
|
||||||
LISTEN_ADDR=
|
|
||||||
JWKS_URL=https://auth.leaflow.cn/realms/Ecosystem/protocol/openid-connect/certs
|
JWKS_URL=https://auth.leaflow.cn/realms/Ecosystem/protocol/openid-connect/certs
|
||||||
|
|
||||||
|
S3_ENDPOINT=
|
||||||
|
S3_ACCESS_KEY=
|
||||||
|
S3_SECRET_KEY=
|
||||||
|
S3_BUCKET=
|
||||||
|
S3_USE_SSL=false
|
||||||
|
|
||||||
DEBUG=false
|
DEBUG=false
|
||||||
|
|
||||||
HTTP_LISTEN_ADDR=127.0.0.1:8080
|
|
@ -20,12 +20,9 @@ type defaultConfig struct {
|
|||||||
Driver string
|
Driver string
|
||||||
}
|
}
|
||||||
|
|
||||||
GRPC struct {
|
ListenAddr struct {
|
||||||
GrpcListenAddr string
|
GRPC string
|
||||||
}
|
HTTP string
|
||||||
|
|
||||||
HTTP struct {
|
|
||||||
ListenAddr string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JWKS struct {
|
JWKS struct {
|
||||||
|
@ -13,8 +13,8 @@ func InitConfig() {
|
|||||||
Config.DB.Driver = "postgres"
|
Config.DB.Driver = "postgres"
|
||||||
Config.Redis.Addr = GetEnv("REDIS_ADDR")
|
Config.Redis.Addr = GetEnv("REDIS_ADDR")
|
||||||
Config.Redis.Pass = GetEnv("REDIS_PASS")
|
Config.Redis.Pass = GetEnv("REDIS_PASS")
|
||||||
Config.GRPC.GrpcListenAddr = GetEnv("LISTEN_ADDR")
|
Config.ListenAddr.GRPC = GetEnv("GRPC_LISTEN_ADDR")
|
||||||
Config.HTTP.ListenAddr = GetEnv("HTTP_LISTEN_ADDR")
|
Config.ListenAddr.HTTP = GetEnv("HTTP_LISTEN_ADDR")
|
||||||
Config.JWKS.Url = GetEnv("JWKS_URL")
|
Config.JWKS.Url = GetEnv("JWKS_URL")
|
||||||
Config.DebugMode.Enable = GetEnv("DEBUG", "false") == "true"
|
Config.DebugMode.Enable = GetEnv("DEBUG", "false") == "true"
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@ var httpCommand = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StartHttp() {
|
func StartHttp() {
|
||||||
if config.Config.HTTP.ListenAddr == "" {
|
if config.Config.ListenAddr.HTTP == "" {
|
||||||
config.Config.HTTP.ListenAddr = "0.0.0.0:8080"
|
config.Config.ListenAddr.HTTP = "0.0.0.0:8080"
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Info("Http Server listening at " + config.Config.HTTP.ListenAddr)
|
logger.Logger.Info("Http Server listening at " + config.Config.ListenAddr.HTTP)
|
||||||
err := facades.Router.Run(config.Config.HTTP.ListenAddr)
|
err := facades.Router.Run(config.Config.ListenAddr.HTTP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("failed to listen: " + err.Error())
|
panic("failed to listen: " + err.Error())
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,15 @@ var rpcCommand = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StartSpiderService() {
|
func StartSpiderService() {
|
||||||
if config.Config.GRPC.GrpcListenAddr == "" {
|
if config.Config.ListenAddr.GRPC == "" {
|
||||||
config.Config.GRPC.GrpcListenAddr = "0.0.0.0:8081"
|
config.Config.ListenAddr.GRPC = "0.0.0.0:8081"
|
||||||
}
|
}
|
||||||
|
|
||||||
lis, err := net.Listen("tcp", config.Config.GRPC.GrpcListenAddr)
|
lis, err := net.Listen("tcp", config.Config.ListenAddr.GRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("failed to listen: " + err.Error())
|
panic("failed to listen: " + err.Error())
|
||||||
}
|
}
|
||||||
logger.Logger.Info("Server listening at " + config.Config.GRPC.GrpcListenAddr)
|
logger.Logger.Info("Server listening at " + config.Config.ListenAddr.GRPC)
|
||||||
|
|
||||||
var opts = []grpc.ServerOption{
|
var opts = []grpc.ServerOption{
|
||||||
grpc.ChainUnaryInterceptor(
|
grpc.ChainUnaryInterceptor(
|
||||||
|
Loading…
Reference in New Issue
Block a user