forked from x/icebergs
add some
This commit is contained in:
parent
06eb4a2582
commit
1abaf50c40
@ -143,10 +143,12 @@ const (
|
||||
CMD_OUT = "cmd_out"
|
||||
|
||||
SH = "sh"
|
||||
RM = "rm"
|
||||
GO = "go"
|
||||
GIT = "git"
|
||||
WGET = "wget"
|
||||
CURL = "curl"
|
||||
TAIL = "tail"
|
||||
MAN = "man"
|
||||
RUN = "run"
|
||||
KILL = "kill"
|
||||
|
@ -157,6 +157,7 @@ const (
|
||||
USR_MODULES = "usr/node_modules/"
|
||||
USR_PACKAGE = "usr/package.json"
|
||||
|
||||
VAR_LOG_BENCH_LOG = "var/log/bench.log"
|
||||
USR_ICONS_AVATAR = "usr/icons/avatar.jpg"
|
||||
USR_ICONS_CONTEXTS = "usr/icons/contexts.jpg"
|
||||
USR_ICONS_ICEBERGS = "usr/icons/icebergs.png"
|
||||
|
@ -34,7 +34,7 @@ func _serve_start(m *ice.Message) {
|
||||
m.Go(func() {
|
||||
m.Cmd(SPIDE, ice.OPS, _serve_address(m)+"/exit", ice.Maps{CLIENT_TIMEOUT: cli.TIME_30ms, ice.LOG_DISABLE: ice.TRUE})
|
||||
}).Sleep(cli.TIME_1s)
|
||||
m.Start("", m.OptionSimple(tcp.HOST, tcp.PORT)...)
|
||||
m.Spawn(ice.Maps{TOKEN: ""}).Start("", m.OptionSimple(tcp.HOST, tcp.PORT)...)
|
||||
m.Cmd(nfs.SAVE, ice.VAR_LOG_ICE_PORT, m.Option(tcp.PORT))
|
||||
if m.Cmd(tcp.HOST).Length() == 0 {
|
||||
return
|
||||
|
@ -345,6 +345,8 @@ func init() {
|
||||
m.Push(nfs.MODULE, ice.Info.Make.Module)
|
||||
m.Push(nfs.VERSION, ice.Info.Make.Versions())
|
||||
m.Push(ORIGIN, m.Option(ice.MSG_USERHOST))
|
||||
m.Push("hostport", UserHost(m))
|
||||
m.Push("pathname", ice.Info.Pathname)
|
||||
}},
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||
}, gdb.EventsAction(SPACE_LOGIN), mdb.HashAction(
|
||||
|
@ -446,6 +446,7 @@ func HostPort(m *ice.Message, host, port string, arg ...string) string {
|
||||
kit.If(kit.Select("", arg, 0), func(pod string) { p += S(pod) })
|
||||
kit.If(kit.Select("", arg, 1), func(cmd string) { p += C(cmd) })
|
||||
}
|
||||
kit.If(m.Option(ice.LOG_DEBUG) == ice.TRUE, func() { p += "?debug=true" })
|
||||
kit.If(host == "", func() { host = kit.ParseURL(UserHost(m)).Hostname() })
|
||||
if port == tcp.PORT_443 {
|
||||
return kit.Format("https://%s", host) + p
|
||||
|
@ -45,11 +45,12 @@ func _publish_file(m *ice.Message, file string, arg ...string) string {
|
||||
return m.Cmdx(nfs.LINK, path.Join(ice.USR_PUBLISH, kit.Select(path.Base(file), arg, 0)), file)
|
||||
}
|
||||
func _publish_contexts(m *ice.Message, arg ...string) {
|
||||
// m.Options(nfs.DIR_ROOT, "")
|
||||
m.OptionDefault(web.DOMAIN, tcp.PublishLocalhost(m, web.UserHost(m)))
|
||||
m.OptionDefault(cli.CTX_CLI, "temp=$(mktemp); if curl -h &>/dev/null; then curl -o $temp -fsSL $ctx_dev; else wget -O $temp -q $ctx_dev; fi; source $temp")
|
||||
m.OptionDefault(cli.CTX_ARG, kit.JoinCmdArgs(aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.LANGUAGE, m.Option(ice.MSG_LANGUAGE)))
|
||||
for _, k := range kit.Default(arg, ice.MISC) {
|
||||
m.Option(web.DOMAIN, strings.Split(m.Option(web.DOMAIN), "?")[0])
|
||||
msg := web.AdminCmd(m, web.SPACE, "info")
|
||||
for _, k := range kit.Default(arg, ice.APP) {
|
||||
env := []string{}
|
||||
switch k {
|
||||
case nfs.SOURCE, ice.DEV:
|
||||
@ -63,13 +64,12 @@ func _publish_contexts(m *ice.Message, arg ...string) {
|
||||
env = append(env, cli.CTX_REPOS, m.Option(nfs.SOURCE))
|
||||
fallthrough
|
||||
case nfs.BINARY, ice.APP:
|
||||
if host := web.HostPort(m, web.AdminCmd(m, tcp.HOST).Append(aaa.IP), web.AdminCmd(m, web.SERVE).Append(tcp.PORT)); m.Option(web.DOMAIN) != host {
|
||||
env = append(env, cli.CTX_DEV_IP, host)
|
||||
if host := msg.Append("hostport"); m.Option(web.DOMAIN) != host {
|
||||
env = append(env, cli.CTX_DEV_IP, strings.Split(host, "?")[0])
|
||||
}
|
||||
// if ice.Info.NodeType == web.WORKER && m.Option(ice.MSG_USERPOD) != "" {
|
||||
if m.Option(ice.MSG_USERPOD) != "" {
|
||||
env = append(env, cli.CTX_POD, m.Option(ice.MSG_USERPOD))
|
||||
} else if name := web.AdminCmd(m, cli.RUNTIME, "boot.pathname").Result(); !kit.IsIn(name, path.Base(m.Option(nfs.SOURCE)), ice.CONTEXTS) {
|
||||
} else if name := msg.Append("pathname"); !kit.IsIn(name, path.Base(m.Option(nfs.SOURCE)), ice.CONTEXTS) {
|
||||
env = append(env, "ctx_name", name)
|
||||
}
|
||||
case cli.CURL, cli.WGET:
|
||||
|
Loading…
x
Reference in New Issue
Block a user