Retrieve function logs from controller (#207)

Establish a proxy server from the controller to the log database.

Redirect query commands send from client to database then proxy back the db response.

Use parameter binding instead of fmt.Sprintf to prevent SQL injection.
This commit is contained in:
Ta-Ching Chen
2017-05-30 14:19:22 -07:00
committed by Soam Vasani
parent 531f69a037
commit 990d943f21
7 changed files with 158 additions and 103 deletions
+4 -13
View File
@@ -49,20 +49,11 @@ type LogEntry struct {
Pod string
}
type DBConfig struct {
DBType string
Endpoint string
Username string
Password string
}
func GetLogDB(cnf DBConfig) (LogDatabase, error) {
switch cnf.DBType {
func GetLogDB(dbType string, serverURL string) (LogDatabase, error) {
switch dbType {
case INFLUXDB:
return NewInfluxDB(cnf)
return NewInfluxDB(serverURL)
}
log.WithFields(log.Fields{
"FISSION_LOGDB_URL": cnf.Endpoint,
}).Fatalf("FISSION_LOGDB_URL is incorrect, now only support %s", INFLUXDB)
log.Fatalf("Log database type is incorrect, now only support %s", INFLUXDB)
return nil, nil
}