common.go 2.3 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 SUPLUS_ADMIN_BASE_HOST = "http://suplus-admin-base-dev.fjmaimaimai.com"

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

//素加销售导航服务
var SUPLUS_SALE_APP = "http://suplus-sale-app-gateway-test.fjmaimaimai.com"

// 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("SUPLUS_ADMIN_BASE_HOST") != "" {
		ALLIED_CREATION_GATEWAY_HOST = os.Getenv("SUPLUS_ADMIN_BASE_HOST")
	}
	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")
	}
	if os.Getenv("SUPLUS_SALE_APP") != "" {
		SUPLUS_SALE_APP = os.Getenv("SUPLUS_SALE_APP")
	}
}