common.go 1.9 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 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 OPEN_API_HOST = "http://mmm-open-api-test.fjmaimaimai.com"

// 数控服务域名地址
var DIGITAL_SERVER_HOST = "http://digitization-server-dev.fjmaimaimai.com"

var BLACK_LIST_USER int64
var BLACK_LIST_COMPANY int64
var WHITE_LIST_USERS []int

func init() {
	LOG_LEVEL = Configurator.DefaultString("LOG_LEVEL", LOG_LEVEL)
	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)
	}
}