BUG修复
This commit is contained in:
@@ -26,7 +26,7 @@ var port = flag.String("port", "6080", "port")
|
|||||||
|
|
||||||
// var port = "6080"
|
// var port = "6080"
|
||||||
var host = flag.String("host", "127.0.0.1:2735", "host")
|
var host = flag.String("host", "127.0.0.1:2735", "host")
|
||||||
var local_path = flag.String("local_path", "/root/apiserver/console_agent", "local_path")
|
var localPath = flag.String("local_path", "/root/apiserver/console_agent", "local_path")
|
||||||
|
|
||||||
var contextPath = "/"
|
var contextPath = "/"
|
||||||
|
|
||||||
@@ -38,9 +38,9 @@ func main() {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
http.Handle(contextPath+"/exec/", websocket.Handler(ExecContainer))
|
http.Handle(contextPath+"/exec/", websocket.Handler(ExecContainer))
|
||||||
http_dir := http.FileServer(http.Dir(*local_path))
|
http_dir := http.FileServer(http.Dir(*localPath))
|
||||||
http.Handle(contextPath+"/", http_dir)
|
http.Handle(contextPath+"/", http.StripPrefix("/console/", http_dir))
|
||||||
// 仅index.html
|
// 仅index.html
|
||||||
|
|
||||||
if err := http.ListenAndServe(":"+*port, nil); err != nil {
|
if err := http.ListenAndServe(":"+*port, nil); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@@ -48,9 +48,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getContainerIdByToken(token string) string {
|
func getContainerIdByToken(token string) string {
|
||||||
// file, err := os.Open(".token")
|
// file, err := os.Open(".token")
|
||||||
token_file := *local_path + "/.token"
|
tokenFile := *localPath + "/.token"
|
||||||
file, err := os.Open(token_file)
|
file, err := os.Open(tokenFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user