postgresql.go 1.1 KB
package constant

import "os"

var POSTGRESQL_DB_NAME = "partner_dev" //partner_test/partner_dev
var POSTGRESQL_USER = "postgres"       //postgres
var POSTGRESQL_PASSWORD = "eagle1010"  //pgsql@123/1993618jack
var POSTGRESQL_HOST = "114.55.200.59"  //127.0.0.1/114.55.200.59
var POSTGRESQL_PORT = "31543"          //5432/31543
var DISABLE_CREATE_TABLE = true
var DISABLE_SQL_GENERATE_PRINT = false

func init() {
	if os.Getenv("POSTGRESQL_DB_NAME") != "" {
		POSTGRESQL_DB_NAME = os.Getenv("POSTGRESQL_DB_NAME")
	}
	if os.Getenv("POSTGRESQL_USER") != "" {
		POSTGRESQL_USER = os.Getenv("POSTGRESQL_USER")
	}
	if os.Getenv("POSTGRESQL_PASSWORD") != "" {
		POSTGRESQL_PASSWORD = os.Getenv("POSTGRESQL_PASSWORD")
	}
	if os.Getenv("POSTGRESQL_HOST") != "" {
		POSTGRESQL_HOST = os.Getenv("POSTGRESQL_HOST")
	}
	if os.Getenv("POSTGRESQL_PORT") != "" {
		POSTGRESQL_PORT = os.Getenv("POSTGRESQL_PORT")
	}
	if os.Getenv("DISABLE_CREATE_TABLE") != "" {
		DISABLE_CREATE_TABLE = true
	}
	if os.Getenv("DISABLE_SQL_GENERATE_PRINT") != "" {
		DISABLE_SQL_GENERATE_PRINT = true
	}
	if POSTGRESQL_DB_NAME == "partner" {
		DISENABLE_MULTI_DEVICE_LOGIN = true
	}
}