common.go 2.8 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 FileStatic = "./static"

var HTTP_PORT int = 8083
var ALLIED_CREATION_GATEWAY_HOST = "http://localhost:8080"

//天联共创基础模块
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 ALLIED_CREATION_MANUFACTURE_HOST = "http://localhost:8083"

// 版本更新模块
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"

var EnableBlockChain = true

// 天联共创 成本结构化
var COST_STRUCTURED = "http://cost-structured-dev.fjmaimaimai.com"
//var COST_STRUCTURED = "http://localhost:8085"

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") != "" {
		SUPLUS_ADMIN_BASE_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("ALLIED_CREATION_MANUFACTURE_HOST") != "" {
		ALLIED_CREATION_MANUFACTURE_HOST = os.Getenv("ALLIED_CREATION_MANUFACTURE_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")
	}
	if os.Getenv("COST_STRUCTURED") != "" {
		COST_STRUCTURED = os.Getenv("COST_STRUCTURED")
	}
}