added xterm-html-file option to server.yaml
This commit is contained in:
parent
65cec65597
commit
ee6d56de67
@ -72,6 +72,7 @@ type ServerAppConfig struct {
|
|||||||
LogRotate int `yaml:"log-rotate"`
|
LogRotate int `yaml:"log-rotate"`
|
||||||
MaxPeers int `yaml:"max-peer-conns"` // maximum number of connections from peers
|
MaxPeers int `yaml:"max-peer-conns"` // maximum number of connections from peers
|
||||||
MaxRpcConns int `yaml:"max-rpc-conns"` // maximum number of rpc connections
|
MaxRpcConns int `yaml:"max-rpc-conns"` // maximum number of rpc connections
|
||||||
|
XtermHtmlFile string `yaml:"xterm-html-file"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClientAppConfig struct {
|
type ClientAppConfig struct {
|
||||||
@ -233,7 +234,7 @@ func make_tls_server_config(cfg *ServerTLSConfig) (*tls.Config, error) {
|
|||||||
cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile)
|
cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile)
|
||||||
} else {
|
} else {
|
||||||
// use the embedded certificate
|
// use the embedded certificate
|
||||||
cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodul_tls_key_text)
|
cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodu_tls_key_text)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load key pair - %s", err)
|
return nil, fmt.Errorf("failed to load key pair - %s", err)
|
||||||
@ -291,7 +292,7 @@ func make_tls_client_config(cfg *ClientTLSConfig) (*tls.Config, error) {
|
|||||||
cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile)
|
cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile)
|
||||||
} else {
|
} else {
|
||||||
// use the embedded certificate
|
// use the embedded certificate
|
||||||
cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodul_tls_key_text)
|
cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodu_tls_key_text)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load key pair - %s", err)
|
return nil, fmt.Errorf("failed to load key pair - %s", err)
|
||||||
|
16
cmd/main.go
16
cmd/main.go
@ -22,7 +22,7 @@ var HODU_VERSION string = "0.0.0"
|
|||||||
//go:embed tls.crt
|
//go:embed tls.crt
|
||||||
var hodu_tls_cert_text []byte
|
var hodu_tls_cert_text []byte
|
||||||
//go:embed tls.key
|
//go:embed tls.key
|
||||||
var hodul_tls_key_text []byte
|
var hodu_tls_key_text []byte
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
type signal_handler struct {
|
type signal_handler struct {
|
||||||
@ -103,6 +103,8 @@ func server_main(ctl_addrs []string, rpc_addrs []string, pxy_addrs []string, wpx
|
|||||||
var logfile_rotate int
|
var logfile_rotate int
|
||||||
var max_rpc_conns int
|
var max_rpc_conns int
|
||||||
var max_peers int
|
var max_peers int
|
||||||
|
var xterm_html_file string
|
||||||
|
var xterm_html string
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
log_mask = hodu.LOG_ALL
|
log_mask = hodu.LOG_ALL
|
||||||
@ -129,6 +131,7 @@ func server_main(ctl_addrs []string, rpc_addrs []string, pxy_addrs []string, wpx
|
|||||||
logfile_rotate = cfg.APP.LogRotate
|
logfile_rotate = cfg.APP.LogRotate
|
||||||
max_rpc_conns = cfg.APP.MaxRpcConns
|
max_rpc_conns = cfg.APP.MaxRpcConns
|
||||||
max_peers = cfg.APP.MaxPeers
|
max_peers = cfg.APP.MaxPeers
|
||||||
|
xterm_html_file = cfg.APP.XtermHtmlFile
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rpc_addrs) <= 0 {
|
if len(rpc_addrs) <= 0 {
|
||||||
@ -144,6 +147,15 @@ func server_main(ctl_addrs []string, rpc_addrs []string, pxy_addrs []string, wpx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if xterm_html_file != "" {
|
||||||
|
var tmp []byte
|
||||||
|
tmp, err = os.ReadFile(xterm_html_file)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to read %s - %s", xterm_html_file, err.Error())
|
||||||
|
}
|
||||||
|
xterm_html = string(tmp)
|
||||||
|
}
|
||||||
|
|
||||||
s, err = hodu.NewServer(
|
s, err = hodu.NewServer(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
logger,
|
logger,
|
||||||
@ -162,6 +174,8 @@ func server_main(ctl_addrs []string, rpc_addrs []string, pxy_addrs []string, wpx
|
|||||||
return fmt.Errorf("failed to create new server - %s", err.Error())
|
return fmt.Errorf("failed to create new server - %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if xterm_html != "" { s.SetXtermHtml(xterm_html) }
|
||||||
|
|
||||||
s.StartService(nil)
|
s.StartService(nil)
|
||||||
s.StartCtlService()
|
s.StartCtlService()
|
||||||
s.StartPxyService()
|
s.StartPxyService()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user