[ADD]Add api-addr-ssl port

This commit is contained in:
崔斌 2017-12-07 11:14:02 +08:00
parent 2c2575dc09
commit 803f0e1aee
3 changed files with 13 additions and 11 deletions

View File

@ -29,6 +29,7 @@ import (
type Config struct {
DBType string
APIAddr string
APIAddrSSL string
DBConnectionInfo string
EventLogServers []string
NodeAPI []string
@ -66,6 +67,7 @@ func (a *APIServer) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&a.DBType, "db-type", "mysql", "db type mysql or etcd")
fs.StringVar(&a.DBConnectionInfo, "mysql", "admin:admin@tcp(127.0.0.1:3306)/region", "mysql db connection info")
fs.StringVar(&a.APIAddr, "api-addr", ":8888", "the api server listen address")
fs.StringVar(&a.APIAddrSSL, "api-addr-ssl", ":8443", "the api server listen address")
fs.StringVar(&a.WebsocketAddr, "ws-addr", ":6060", "the websocket server listen address")
fs.BoolVar(&a.APISSL, "api-ssl-enable", false, "whether to enable websocket SSL")
fs.StringVar(&a.APICertFile, "api-ssl-certfile", "", "api ssl cert file")

View File

@ -132,7 +132,7 @@ func (m *Manager) Run() {
}
}()
if m.conf.APISSL {
logrus.Infof("api listen on (HTTPs) 0.0.0.0%v", m.conf.APIAddr)
logrus.Infof("api listen on (HTTPs) 0.0.0.0%v", m.conf.APIAddrSSL)
logrus.Fatal(http.ListenAndServeTLS(m.conf.APIAddr, m.conf.APICertFile, m.conf.APIKeyFile, m.r))
} else {
logrus.Infof("api listen on (HTTP) 0.0.0.0%v", m.conf.APIAddr)

View File

@ -163,14 +163,14 @@ func (m *Manager) patchTable() {
// m.db.Exec("alter table tenant_services add replica_id varchar(32)")
// m.db.Exec("alter table tenant_services add status int(11) default 0")
// m.db.Exec("alter table tenant_services add node_label varchar(40)")
m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/tenants','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/show','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/resources','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/opentsdb','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/nodes','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/job','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/tasks','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/taskgroups','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/tasktemps','','','')")
m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/configs','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/tenants','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/show','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/resources','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','server_source','/v2/opentsdb','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/nodes','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/job','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/tasks','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/taskgroups','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/tasktemps','','','')")
// m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/configs','','','')")
}