Add explicit user-service autostart configuration
This commit is contained in:
+8
-10
@@ -7,7 +7,6 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/cli"
|
||||
"git.a-wan.net/alan/pipelines/internal/installation"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
@@ -19,6 +18,12 @@ func main() {
|
||||
app := cli.App{Out: os.Stdout, Err: os.Stderr, In: os.Stdin}
|
||||
args := os.Args[1:]
|
||||
executable, err := os.Executable()
|
||||
if err == nil && len(args) > 0 && args[0] == "service" {
|
||||
err = installation.ServiceCommand(ctx, executable, args[1:], os.Stdout, os.Stderr)
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
var config *installation.Config
|
||||
if err == nil {
|
||||
config, err = installation.Load(executable)
|
||||
@@ -39,15 +44,8 @@ func main() {
|
||||
}
|
||||
}
|
||||
if err == nil && config == nil && len(args) > 0 && args[0] == "serve" {
|
||||
server, findErr := exec.LookPath("pipelines-server")
|
||||
if findErr != nil {
|
||||
resolved, resolveErr := filepath.EvalSymlinks(executable)
|
||||
if resolveErr != nil {
|
||||
err = resolveErr
|
||||
} else {
|
||||
server = filepath.Join(filepath.Dir(resolved), "pipelines-server")
|
||||
}
|
||||
}
|
||||
var server string
|
||||
server, err = installation.ServerExecutable(executable)
|
||||
if err == nil {
|
||||
err = syscall.Exec(server, append([]string{server}, args[1:]...), os.Environ())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user