forked from x/icebergs
add some
This commit is contained in:
parent
1a75e9a77e
commit
4e12b37e33
@ -92,8 +92,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
PUBLISH: {Hand: func(m *ice.Message, arg ...string) {
|
PUBLISH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, p := range []string{LOCALHOST, "127.0.0.1", strings.ToLower(ice.Info.Hostname)} {
|
for _, p := range []string{LOCALHOST, "127.0.0.1", m.Option("tcp_localhost")} {
|
||||||
if strings.Contains(arg[0], p) {
|
if p != "" && strings.Contains(arg[0], p) {
|
||||||
arg[0] = strings.Replace(arg[0], p, _host_domain(m), 1)
|
arg[0] = strings.Replace(arg[0], p, _host_domain(m), 1)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ func UserWeb(m Message) *url.URL {
|
|||||||
func UserHost(m *ice.Message) string {
|
func UserHost(m *ice.Message) string {
|
||||||
if p := m.Option(ice.MSG_USERHOST); p != "" {
|
if p := m.Option(ice.MSG_USERHOST); p != "" {
|
||||||
return p
|
return p
|
||||||
} else if u := UserWeb(m); kit.HasSuffix(u.Hostname(), tcp.LOCALHOST, ".local") {
|
} else if u := UserWeb(m); u.Hostname() == tcp.LOCALHOST {
|
||||||
return m.Option(ice.MSG_USERHOST, tcp.PublishLocalhost(m, u.Scheme+"://"+u.Host))
|
return m.Option(ice.MSG_USERHOST, tcp.PublishLocalhost(m, u.Scheme+"://"+u.Host))
|
||||||
} else {
|
} else {
|
||||||
return m.Option(ice.MSG_USERHOST, u.Scheme+"://"+u.Host)
|
return m.Option(ice.MSG_USERHOST, u.Scheme+"://"+u.Host)
|
||||||
|
@ -94,7 +94,6 @@ func _autogen_git(m *ice.Message, arg ...string) ice.Map {
|
|||||||
return kit.Dict(arg, aaa.USERNAME, m.Option(ice.MSG_USERNAME), tcp.HOSTNAME, ice.Info.Hostname, nfs.PATH, kit.Path("")+nfs.PS, mdb.TIME, m.Time(),
|
return kit.Dict(arg, aaa.USERNAME, m.Option(ice.MSG_USERNAME), tcp.HOSTNAME, ice.Info.Hostname, nfs.PATH, kit.Path("")+nfs.PS, mdb.TIME, m.Time(),
|
||||||
GIT, GitVersion(m), GO, GoVersion(m), nfs.MODULE, _autogen_mod(m, ice.GO_MOD),
|
GIT, GitVersion(m), GO, GoVersion(m), nfs.MODULE, _autogen_mod(m, ice.GO_MOD),
|
||||||
msg.AppendSimple("remote,branch,version,forword,author,email,hash,when,message"),
|
msg.AppendSimple("remote,branch,version,forword,author,email,hash,when,message"),
|
||||||
// web.DOMAIN, strings.ReplaceAll(tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB)), "%2F", nfs.PS),
|
|
||||||
web.DOMAIN, m.Spawn(kit.Dict(ice.MSG_USERWEB, m.Option(ice.MSG_USERHOST), ice.MSG_USERPOD, m.Option(ice.MSG_USERPOD))).MergePod(""),
|
web.DOMAIN, m.Spawn(kit.Dict(ice.MSG_USERWEB, m.Option(ice.MSG_USERHOST), ice.MSG_USERPOD, m.Option(ice.MSG_USERPOD))).MergePod(""),
|
||||||
cli.SYSTEM, ice.Info.System,
|
cli.SYSTEM, ice.Info.System,
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/lex"
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
@ -45,11 +46,15 @@ func _publish_file(m *ice.Message, file string, arg ...string) string {
|
|||||||
}
|
}
|
||||||
func _publish_contexts(m *ice.Message, arg ...string) {
|
func _publish_contexts(m *ice.Message, arg ...string) {
|
||||||
m.Options(nfs.DIR_ROOT, "").OptionDefault(ice.MSG_USERNAME, "demo")
|
m.Options(nfs.DIR_ROOT, "").OptionDefault(ice.MSG_USERNAME, "demo")
|
||||||
|
m.Option("tcp_localhost", strings.ToLower(ice.Info.Hostname))
|
||||||
|
host := tcp.PublishLocalhost(m, web.UserHost(m))
|
||||||
for _, k := range kit.Default(arg, ice.MISC) {
|
for _, k := range kit.Default(arg, ice.MISC) {
|
||||||
m.OptionDefault(web.DOMAIN, web.UserHost(m))
|
m.OptionDefault(web.DOMAIN, host)
|
||||||
m.Options(cli.CTX_ENV, kit.Select("", lex.SP+kit.JoinKV(mdb.EQ, lex.SP, cli.CTX_POD, m.Option(ice.MSG_USERPOD)), m.Option(ice.MSG_USERPOD) != ""))
|
m.Options(cli.CTX_ENV, kit.Select("", lex.SP+kit.JoinKV(mdb.EQ, lex.SP, cli.CTX_POD, m.Option(ice.MSG_USERPOD)), m.Option(ice.MSG_USERPOD) != ""))
|
||||||
kit.If(m.Option("ctx_dev_ip"), func(p string) { m.Option(cli.CTX_ENV, m.Option(cli.CTX_DEV)+" "+"ctx_dev_ip="+p) })
|
kit.If(m.Option("ctx_dev_ip"), func(p string) {
|
||||||
m.Option(ice.TCP_DOMAIN, kit.ParseURL(web.UserHost(m)).Hostname())
|
m.Option(cli.CTX_ENV, m.Option(cli.CTX_DEV)+" "+"ctx_dev_ip="+tcp.PublishLocalhost(m, p))
|
||||||
|
})
|
||||||
|
m.Option(ice.TCP_DOMAIN, kit.ParseURL(host).Hostname())
|
||||||
switch k {
|
switch k {
|
||||||
case INSTALL:
|
case INSTALL:
|
||||||
m.Option("format", "raw")
|
m.Option("format", "raw")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user