common.go 2.5 KB
package constant

import (
	"fmt"
	"strconv"
	"strings"
)

var SERVICE_NAME = "character-library-metadata-bastion"
var SERVICE_ENV = "dev"
var HTTP_PORT int = 8081
var CACHE_PREFIX = "character-library-metadata-bastion-dev"
var LOG_LEVEL = "debug"
var LOG_FILE = "app.log"
var PPROF_ON = true

//天联共创基础模块
//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 MMM_BYTE_BANK_HOST = "http://220.250.41.79:8301"

var METADATA_BASTION_HOST = "http://127.0.0.1:8080"

var BYTE_CORE_HOST = "http://192.168.100.34:8303"

var AUTH_SERVER_HOST = "http://digital-platform-dev.fjmaimaimai.com"

var BLACK_LIST_USER int64
var BLACK_LIST_COMPANY int64
var WHITE_LIST_USERS []int

//var CUSTOMER_ACCOUNT = []int64{3129687560814592, 3129687690100739, 3492238958608384}

//const CUSTOMER_ACCOUNT_DELIMITER = ","

/*****   1.数据传输  *****/
//const HeaderCompanyId = "companyId"
//const HeaderUserId = "userId"
//const HeaderOrgId = "orgId"
//const HeaderOrgIds = "orgIds"

func init() {
	LOG_LEVEL = Configurator.DefaultString("LOG_LEVEL", LOG_LEVEL)
	//ALLIED_CREATION_BASIC_HOST = Configurator.DefaultString("ALLIED_CREATION_BASIC_HOST", ALLIED_CREATION_BASIC_HOST)
	ALLIED_CREATION_USER_HOST = Configurator.DefaultString("ALLIED_CREATION_USER_HOST", ALLIED_CREATION_USER_HOST)
	MMM_BYTE_BANK_HOST = Configurator.DefaultString("MMM_BYTE_BANK_HOST", MMM_BYTE_BANK_HOST)
	METADATA_BASTION_HOST = Configurator.DefaultString("METADATA_BASTION_HOST", METADATA_BASTION_HOST)
	BYTE_CORE_HOST = Configurator.DefaultString("BYTE_CORE_HOST", BYTE_CORE_HOST)
	SERVICE_ENV = Configurator.DefaultString("SERVICE_ENV", SERVICE_ENV)
	HTTP_PORT = Configurator.DefaultInt("HTTP_PORT", HTTP_PORT)
	AUTH_SERVER_HOST = Configurator.DefaultString("AUTH_SERVER_HOST", AUTH_SERVER_HOST)
	SERVICE_NAME = fmt.Sprintf("%v-%v", SERVICE_NAME, SERVICE_ENV)
	PPROF_ON = Configurator.DefaultBool("PPROF_ON", PPROF_ON)
	CACHE_PREFIX = SERVICE_NAME + ":" + SERVICE_ENV

	BLACK_LIST_USER = Configurator.DefaultInt64("BLACK_LIST_USER", BLACK_LIST_USER)
	BLACK_LIST_COMPANY = Configurator.DefaultInt64("BLACK_LIST_COMPANY", BLACK_LIST_COMPANY)

	whiteListUsers := strings.Split(Configurator.DefaultString("WHITE_LIST_USERS", ""), ",")
	for _, userId := range whiteListUsers {
		v, _ := strconv.Atoi(userId)
		WHITE_LIST_USERS = append(WHITE_LIST_USERS, v)
	}
}