update
This commit is contained in:
@@ -28,18 +28,21 @@ func init() {
|
|||||||
{
|
{
|
||||||
Rules: []string{`^env\s+get\s+([\S]+)$`},
|
Rules: []string{`^env\s+get\s+([\S]+)$`},
|
||||||
Handle: func(s im.Sender) interface{} {
|
Handle: func(s im.Sender) interface{} {
|
||||||
m := s.Get()
|
name := s.Get()
|
||||||
env, err := GetEnv(m)
|
envs, err := GetEnvs(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if env == nil {
|
if len(envs) == 0 {
|
||||||
return "未设置该环境变量"
|
return "未设置该环境变量"
|
||||||
}
|
}
|
||||||
if env != nil {
|
es := []string{}
|
||||||
return formatEnv(env)
|
for _, env := range envs {
|
||||||
|
if env.Name == name {
|
||||||
|
es = append(es, formatEnv(&env))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return strings.Join(es, "\n\n")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -32,6 +33,9 @@ var ENVS = "envs"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
core.ReadYaml(core.ExecPath+"/develop/qinglong/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/develop/qinglong/conf/demo_config.yaml")
|
core.ReadYaml(core.ExecPath+"/develop/qinglong/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/develop/qinglong/conf/demo_config.yaml")
|
||||||
|
if v := regexp.MustCompile(`^(https?://[\.\w]+:?\d*)`).FindStringSubmatch(Config.Host); len(v) == 2 {
|
||||||
|
Config.Host = v[1]
|
||||||
|
}
|
||||||
_, err := getToken()
|
_, err := getToken()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logs.Info("青龙已连接")
|
logs.Info("青龙已连接")
|
||||||
|
|||||||
Reference in New Issue
Block a user