From 803f0e1aee2b1ae783c0981a11c97d29151bdc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E6=96=8C?= Date: Thu, 7 Dec 2017 11:14:02 +0800 Subject: [PATCH] [ADD]Add api-addr-ssl port --- cmd/api/option/option.go | 2 ++ pkg/api/server/api.go | 2 +- pkg/db/mysql/mysql.go | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/api/option/option.go b/cmd/api/option/option.go index db048e2e3..225daa7f3 100644 --- a/cmd/api/option/option.go +++ b/cmd/api/option/option.go @@ -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") diff --git a/pkg/api/server/api.go b/pkg/api/server/api.go index c5eac3d50..c1033c439 100644 --- a/pkg/api/server/api.go +++ b/pkg/api/server/api.go @@ -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) diff --git a/pkg/db/mysql/mysql.go b/pkg/db/mysql/mysql.go index 189fb98dd..af8a1adfc 100644 --- a/pkg/db/mysql/mysql.go +++ b/pkg/db/mysql/mysql.go @@ -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','','','')") }