From 7878834155713bd2b68a229de5699c6d8fbb86d1 Mon Sep 17 00:00:00 2001 From: Jon Lundy Date: Mon, 30 Nov 2020 11:53:49 -0700 Subject: [PATCH] fixes and such --- main.go | 2 ++ pkg/keyproofs/routes-avatar.go | 6 +++--- sour.is-keyproofs.service | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 87b62d9..7656bcc 100644 --- a/main.go +++ b/main.go @@ -135,6 +135,8 @@ func run(ctx context.Context) error { Str("build-hash", cfg.GetString("build-hash")). Str("build-date", cfg.GetString("build-date")). Str("listen", listen). + Int("user", os.Geteuid()). + Int("group", os.Getgid()). Msg("startup") err := New(&http.Server{ diff --git a/pkg/keyproofs/routes-avatar.go b/pkg/keyproofs/routes-avatar.go index c957d19..80d07ae 100644 --- a/pkg/keyproofs/routes-avatar.go +++ b/pkg/keyproofs/routes-avatar.go @@ -28,7 +28,7 @@ func NewAvatarApp(ctx context.Context, path string) (*avatarApp, error) { app := &avatarApp{path: path} err := app.CheckFiles(ctx) if err != nil { - return nil, err + return nil, fmt.Errorf("check files: %w", err) } watch, err := fsnotify.NewWatcher() @@ -38,7 +38,7 @@ func NewAvatarApp(ctx context.Context, path string) (*avatarApp, error) { for _, typ := range []string{"avatar", "bg", "cover"} { err = watch.Add(filepath.Join(path, typ)) if err != nil { - return nil, err + return nil, fmt.Errorf("adding watch: %w", err) } } @@ -91,7 +91,7 @@ func (app *avatarApp) CheckFiles(ctx context.Context) error { return filepath.Walk(app.path, func(path string, info os.FileInfo, err error) error { if err != nil { - return err + return fmt.Errorf("walk failed: %w", err) } if info.IsDir() { if info.Name() == ".links" { diff --git a/sour.is-keyproofs.service b/sour.is-keyproofs.service index 285486f..edb585e 100644 --- a/sour.is-keyproofs.service +++ b/sour.is-keyproofs.service @@ -1,10 +1,11 @@ [Unit] -Description=sour.is paste API +Description=sour.is KeyProofs API After=syslog.target network.target [Service] Type=simple User=www-data +Group=www-data WorkingDirectory=/var/www ExecStart=/usr/local/bin/sour.is-keyproofs