BUG修复

This commit is contained in:
2024-05-20 15:39:31 +08:00
parent f8c557e78b
commit 9af209ca75
+7 -7
View File
@@ -26,7 +26,7 @@ var port = flag.String("port", "6080", "port")
// var port = "6080"
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 = "/"
@@ -38,9 +38,9 @@ func main() {
// }
http.Handle(contextPath+"/exec/", websocket.Handler(ExecContainer))
http_dir := http.FileServer(http.Dir(*local_path))
http.Handle(contextPath+"/", http_dir)
// 仅index.html
http_dir := http.FileServer(http.Dir(*localPath))
http.Handle(contextPath+"/", http.StripPrefix("/console/", http_dir))
// 仅index.html
if err := http.ListenAndServe(":"+*port, nil); err != nil {
panic(err)
@@ -48,9 +48,9 @@ func main() {
}
func getContainerIdByToken(token string) string {
// file, err := os.Open(".token")
token_file := *local_path + "/.token"
file, err := os.Open(token_file)
// file, err := os.Open(".token")
tokenFile := *localPath + "/.token"
file, err := os.Open(tokenFile)
if err != nil {
return ""
}