common.go 1.9 KB
package constant

import (
	"os"
	"strconv"
)

const SERVICE_NAME = "allied-creation-gateway"

var LOG_LEVEL = "debug"
var LOG_TYPE = "console"    // file, console, es
var LOG_FRAMEWORK = "beego" // beego logrus
var LOG_FILE = "app.log"
var LOG_PREFIX = "[allied-creation-gateway]"

var HTTP_PORT int = 8083
var ALLIED_CREATION_GATEWAY_HOST = "https://allied-creation-gateway-dev.fjmaimaimai.com"

//天联共创基础模块
var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" //"http://allied-creation-basic-dev.fjmaimaimai.com"

//天联共创用户模块
var ALLIED_CREATION_USER_HOST = "http://localhost:8081" //"http://allied-creation-user-dev.fjmaimaimai.com"

//天联共创业务模块
var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied-creation-cooperation-dev.fjmaimaimai.com"

//通用模块短信服务
var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897"

// TODO:特殊短信验证码,不验证,正式环境注入空
var SMSCODE_ALL_POWER = "999512"

func init() {
	if os.Getenv("LOG_LEVEL") != "" {
		LOG_LEVEL = os.Getenv("LOG_LEVEL")
	}
	if os.Getenv("LOG_TYPE") != "" {
		LOG_TYPE = os.Getenv("LOG_TYPE")
	}
	if os.Getenv("ALLIED_CREATION_GATEWAY_HOST") != "" {
		ALLIED_CREATION_GATEWAY_HOST = os.Getenv("ALLIED_CREATION_GATEWAY_HOST")
	}
	if os.Getenv("ALLIED_CREATION_BASIC_HOST") != "" {
		ALLIED_CREATION_BASIC_HOST = os.Getenv("ALLIED_CREATION_BASIC_HOST")
	}
	if os.Getenv("ALLIED_CREATION_USER_HOST") != "" {
		ALLIED_CREATION_USER_HOST = os.Getenv("ALLIED_CREATION_USER_HOST")
	}
	if os.Getenv("ALLIED_CREATION_COOPERATION_HOST") != "" {
		ALLIED_CREATION_COOPERATION_HOST = os.Getenv("ALLIED_CREATION_COOPERATION_HOST")
	}
	if os.Getenv("SMS_SERVE_HOST") != "" {
		SMS_SERVE_HOST = os.Getenv("SMS_SERVE_HOST")
	}
	if os.Getenv("HTTP_PORT") != "" {
		HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
	}
	if os.Getenv("SMSCODE_ALL_POWER") != "" {
		SMSCODE_ALL_POWER = os.Getenv("SMSCODE_ALL_POWER")
	}
}