Browse Source

add HttpPort special process

pull/165/head
yedf2 4 years ago
parent
commit
960d6912e2
  1. 5
      conf.sample.yml
  2. 2
      dtmcli/logger/log.go
  3. 7
      dtmsvr/config/config_utils.go

5
conf.sample.yml

@ -2,7 +2,7 @@
### dtm can be run without any config.
### all config in this file is optional. the default value is as specified in each line
### all configs can be specified from env. for example:
### Store.MaxOpenConns can also specified from env: STORE_MAX_OPEN_CONNS
### MicroService.EndPoint => MICRO_SERVICE_END_POINT
#####################################################################
# Store: # specify which engine to store trans status
@ -49,4 +49,5 @@
# RetryInterval: 10 # the subtrans branch will be retried after this interval
# LogLevel: 'info' # default: info. can be debug|info|warn|error
# HttpPort: 36789
# GrpcPort: 36790

2
dtmcli/logger/log.go

@ -13,7 +13,7 @@ import (
var logger Logger = nil
func init() {
InitLog("info")
InitLog(os.Getenv("LOG_LEVEL"))
}
// Logger logger interface

7
dtmsvr/config/config_utils.go

@ -49,9 +49,12 @@ func loadFromEnvInner(prefix string, conf reflect.Value, defaultValue string) {
func toUnderscoreUpper(key string) string {
key = strings.Trim(key, "_")
matchLastCap := regexp.MustCompile("([A-Z])([A-Z][a-z])")
s2 := matchLastCap.ReplaceAllString(key, "${1}_${2}")
matchFirstCap := regexp.MustCompile("([a-z])([A-Z]+)")
s2 := matchFirstCap.ReplaceAllString(key, "${1}_${2}")
// logger.Debugf("loading from env: %s", strings.ToUpper(s2))
s2 = matchFirstCap.ReplaceAllString(s2, "${1}_${2}")
// logger.Infof("loading from env: %s", strings.ToUpper(s2))
return strings.ToUpper(s2)
}

Loading…
Cancel
Save