44 lines
881 B
Go
44 lines
881 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
type CA_CFG struct {
|
|
Org string
|
|
FQDN string
|
|
}
|
|
|
|
var Host string
|
|
var Port string
|
|
var PersistentPath string
|
|
var CA_config CA_CFG
|
|
|
|
// the real endpoint that you should access the server
|
|
// e.g. 172.16.0.1:3232
|
|
var Outbound string
|
|
|
|
func GetListen() {
|
|
viper.SetDefault("host", "localhost")
|
|
viper.SetDefault("port", "8086")
|
|
Host = viper.GetString("host")
|
|
Port = viper.GetString("port")
|
|
viper.SetDefault("outbound", fmt.Sprintf("%s:%s", Host, Port))
|
|
Outbound = viper.GetString("outbound")
|
|
}
|
|
|
|
func GetPersistent() {
|
|
viper.SetDefault("store", "/tmp/db")
|
|
PersistentPath = viper.GetString("store")
|
|
}
|
|
|
|
func GetCA_CFG() {
|
|
viper.SetDefault("ca.organization", "TCIVS_CSE_CR")
|
|
viper.SetDefault("ca.fqdn", "example.com")
|
|
CA_config = CA_CFG{
|
|
Org: viper.GetString("ca.organization"),
|
|
FQDN: viper.GetString("ca.fqdn"),
|
|
}
|
|
}
|