mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Add --no-register flag and register-account CLI
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
Author: https://github.com/REUSS-dev
This commit is contained in:
+18
-2
@@ -97,7 +97,12 @@ func main() {
|
||||
// (the listener still only binds if LUNAR_ADMIN_TOKEN is set in the env).
|
||||
adminListen := flag.String("admin.listen", "", "lunar-tear admin webhook listen address (host:port). Empty = leave default; webhook only binds when LUNAR_ADMIN_TOKEN is set in the env.")
|
||||
|
||||
// Controlled server access
|
||||
noRegister := flag.Bool("no-register", false, "Disallow new account registrations for clients, when present. Default = false")
|
||||
|
||||
// dev utility output config
|
||||
noColor := flag.Bool("no-color", false, "disable colored output")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if *grpcOctoURL == "" {
|
||||
@@ -122,6 +127,11 @@ func main() {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
noreg_s := ""
|
||||
if *noRegister {
|
||||
noreg_s = "--no-register"
|
||||
}
|
||||
|
||||
services := []service{
|
||||
{
|
||||
label: "auth",
|
||||
@@ -129,6 +139,7 @@ func main() {
|
||||
cmd: exec.CommandContext(ctx, filepath.Join("bin", "auth-server"+ext),
|
||||
"--listen", *authListen,
|
||||
"--db", *authDB,
|
||||
noreg_s,
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -143,7 +154,7 @@ func main() {
|
||||
label: "grpc",
|
||||
color: colorYellow,
|
||||
cmd: exec.CommandContext(ctx, filepath.Join("bin", "lunar-tear"+ext),
|
||||
grpcArgs(*grpcListen, *grpcPublicAddr, *grpcDB, *grpcOctoURL, *grpcAuthURL, *adminListen)...,
|
||||
grpcArgs(*grpcListen, *grpcPublicAddr, *grpcDB, *grpcOctoURL, *grpcAuthURL, *adminListen, *noRegister)...,
|
||||
),
|
||||
},
|
||||
}
|
||||
@@ -204,7 +215,7 @@ func prefixLines(wg *sync.WaitGroup, prefix string, r io.Reader) {
|
||||
// grpcArgs assembles the argv for the lunar-tear subprocess. The admin flag
|
||||
// is appended only when --admin.listen was supplied so we don't override
|
||||
// lunar-tear's own default when the operator hasn't opted in.
|
||||
func grpcArgs(listen, publicAddr, db, octoURL, authURL, adminListen string) []string {
|
||||
func grpcArgs(listen, publicAddr, db, octoURL, authURL, adminListen string, noRegister bool) []string {
|
||||
args := []string{
|
||||
"--listen", listen,
|
||||
"--public-addr", publicAddr,
|
||||
@@ -212,8 +223,13 @@ func grpcArgs(listen, publicAddr, db, octoURL, authURL, adminListen string) []st
|
||||
"--octo-url", octoURL,
|
||||
"--auth-url", authURL,
|
||||
}
|
||||
|
||||
if adminListen != "" {
|
||||
args = append(args, "--admin-listen", adminListen)
|
||||
}
|
||||
|
||||
if noRegister {
|
||||
args = append(args, "--no-register")
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user