Conceal env in executables
This commit is contained in:
parent
941352b80d
commit
e848117f4c
@ -17,7 +17,6 @@ import (
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/session"
|
||||
|
||||
@ -35,10 +34,6 @@ var (
|
||||
menuSeparator = ": "
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
@ -58,8 +53,8 @@ func main() {
|
||||
flag.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", env.GetEnv("HOST", "127.0.0.1"), "http host")
|
||||
flag.UintVar(&port, "p", env.GetEnvUint("PORT", 7123), "http port")
|
||||
flag.StringVar(&host, "h", config.Host(), "http host")
|
||||
flag.UintVar(&port, "p", config.Port(), "http port")
|
||||
flag.StringVar(&gettextDir, "gettext", "", "use gettext translations from given directory")
|
||||
flag.Var(&langs, "language", "add symbol resolution for language")
|
||||
flag.Parse()
|
||||
@ -147,7 +142,7 @@ func main() {
|
||||
sh := at.NewATRequestHandler(bsh)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle(env.GetEnv("AT_ENDPOINT", "/"), sh)
|
||||
mux.Handle(config.ATEndpoint(), sh)
|
||||
|
||||
s := &http.Server{
|
||||
Addr: fmt.Sprintf("%s:%s", host, strconv.Itoa(int(port))),
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/session"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/request"
|
||||
@ -30,10 +29,6 @@ var (
|
||||
menuSeparator = ": "
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
type asyncRequestParser struct {
|
||||
sessionId string
|
||||
input []byte
|
||||
@ -66,8 +61,8 @@ func main() {
|
||||
flag.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", env.GetEnv("HOST", "127.0.0.1"), "http host")
|
||||
flag.UintVar(&port, "p", env.GetEnvUint("PORT", 7123), "http port")
|
||||
flag.StringVar(&host, "h", config.Host(), "http host")
|
||||
flag.UintVar(&port, "p", config.Port(), "http port")
|
||||
flag.StringVar(&gettextDir, "gettext", "", "use gettext translations from given directory")
|
||||
flag.Var(&langs, "language", "add symbol resolution for language")
|
||||
flag.Parse()
|
||||
|
@ -17,7 +17,6 @@ import (
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
httpsession "git.grassecon.net/grassrootseconomics/visedriver/session/http"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/session"
|
||||
@ -33,10 +32,6 @@ var (
|
||||
menuSeparator = ": "
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
@ -54,8 +49,8 @@ func main() {
|
||||
flag.StringVar(&connStr, "c", "", "connection string")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", env.GetEnv("HOST", "127.0.0.1"), "http host")
|
||||
flag.UintVar(&port, "p", env.GetEnvUint("PORT", 7123), "http port")
|
||||
flag.StringVar(&host, "h", config.Host(), "http host")
|
||||
flag.UintVar(&port, "p", config.Port(), "http port")
|
||||
flag.StringVar(&gettextDir, "gettext", "", "use gettext translations from given directory")
|
||||
flag.Var(&langs, "language", "add symbol resolution for language")
|
||||
flag.Parse()
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
"git.defalsify.org/vise.git/lang"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/args"
|
||||
@ -25,9 +24,6 @@ var (
|
||||
menuSeparator = ": "
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
// TODO: external script automatically generate language handler list from select language vise code OR consider dynamic menu generation script possibility
|
||||
func main() {
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/ssh"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
)
|
||||
@ -29,10 +28,6 @@ var (
|
||||
build = "dev"
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
@ -49,8 +44,8 @@ func main() {
|
||||
flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir")
|
||||
flag.BoolVar(&engineDebug, "d", false, "use engine debug output")
|
||||
flag.UintVar(&size, "s", 160, "max size of output")
|
||||
flag.StringVar(&host, "h", "127.0.0.1", "socket host")
|
||||
flag.UintVar(&port, "p", 7122, "socket port")
|
||||
flag.StringVar(&host, "h", config.HostSSH(), "socket host")
|
||||
flag.UintVar(&port, "p", config.PortSSH(), "socket port")
|
||||
flag.Parse()
|
||||
|
||||
if connStr == "" {
|
||||
|
@ -1,10 +1,20 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
|
||||
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
const (
|
||||
defaultSSHHost string = "127.0.0.1"
|
||||
defaultSSHPort uint = 7122
|
||||
)
|
||||
|
||||
var (
|
||||
DbConn = viseconfig.DbConn
|
||||
DefaultLanguage = viseconfig.DefaultLanguage
|
||||
@ -23,3 +33,23 @@ func LoadConfig() error {
|
||||
DefaultLanguage = viseconfig.DefaultLanguage
|
||||
return nil
|
||||
}
|
||||
|
||||
func Host() string {
|
||||
return apiconfig.Host()
|
||||
}
|
||||
|
||||
func Port() uint {
|
||||
return apiconfig.Port()
|
||||
}
|
||||
|
||||
func HostSSH() string {
|
||||
return defaultSSHHost
|
||||
}
|
||||
|
||||
func PortSSH() uint {
|
||||
return defaultSSHPort
|
||||
}
|
||||
|
||||
func ATEndpoint() string {
|
||||
return env.GetEnv("AT_ENDPOINT", "/")
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.defalsify.org/vise.git/lang"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -35,10 +34,6 @@ var (
|
||||
incmps string
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
func toLanguageLabel(ln lang.Language) string {
|
||||
s := ln.Name
|
||||
v := strings.Split(s, " (")
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"path"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/debug"
|
||||
"git.defalsify.org/vise.git/db"
|
||||
@ -20,11 +19,6 @@ var (
|
||||
scriptDir = path.Join("services", "registration")
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
|
||||
func formatItem(k []byte, v []byte) (string, error) {
|
||||
o, err := debug.FromKey(k)
|
||||
if err != nil {
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"git.defalsify.org/vise.git/logging"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
||||
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/store"
|
||||
storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db"
|
||||
)
|
||||
@ -23,10 +22,6 @@ var (
|
||||
scriptDir = path.Join("services", "registration")
|
||||
)
|
||||
|
||||
func init() {
|
||||
env.LoadEnvVariables()
|
||||
}
|
||||
|
||||
func main() {
|
||||
config.LoadConfig()
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.23.4
|
||||
require (
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250112102149-4feac5e490e9
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112102608-1152fb71a590
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112110836-26a51bc95f38
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112104023-611c5a8dfc80
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250112104256-7d37d7f5cac5
|
||||
github.com/alecthomas/assert/v2 v2.2.2
|
||||
|
4
go.sum
4
go.sum
@ -2,8 +2,8 @@ git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d h1:bPAOVZOX4frSG
|
||||
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250112102149-4feac5e490e9 h1:dQ8DtiOUPzzXYgZw6REnIc1dhb3PzCEfN01Rd7Pbw+o=
|
||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250112102149-4feac5e490e9/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112102608-1152fb71a590 h1:2twsWy9E3aWgKeY1rNaD/CTq2VtAQfaAhOstTQVQQrc=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112102608-1152fb71a590/go.mod h1:vgPJiqbRBlpsMt1iFd94onNvE7I9s6r78Ph2CpxOUMs=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112110836-26a51bc95f38 h1:M++O6THA26LRdC7jfsPCaIIPMosNhFc+PgnEtDY3+hk=
|
||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112110836-26a51bc95f38/go.mod h1:E0ayNSbqpt+aAHoA7f7jXZcH2Zgjkt7rYs50YH9sLgk=
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112104023-611c5a8dfc80 h1:8j7iDSC9lzOM8NexEQlMfEn+3mJStDf66OTZK8ulsho=
|
||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112104023-611c5a8dfc80/go.mod h1:E6W7ZOa7ZvVr0Bc5ot0LNSwpSPYq4hXlAIvEPy3AJ7U=
|
||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250112104256-7d37d7f5cac5 h1:byD+vsY9kqCVFX2Kx2+Z3/Lqk10l4MQnUBXm/zLpy20=
|
||||
|
Loading…
Reference in New Issue
Block a user