From 70faa4e2257679182cbe4ff833f00045fae57a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 25 Jan 2024 12:25:06 +0100 Subject: [PATCH] Move URLs to the Flamenco website to constants in a dedicated package Create a dedicated package `.../pkg/website` to contain constants for the URLs of documentation, bug reporting, etc. That way it's easier to see which parts of the website are being referred to from the Flamenco binaries, and updates can happen in a central spot. No functional changes. --- cmd/flamenco-worker/find_exes.go | 3 ++- internal/manager/persistence/db_migration.go | 5 +++-- internal/worker/persistence/db_migration.go | 5 +++-- pkg/shaman/server.go | 13 +++++++------ pkg/website/urls.go | 9 +++++++++ 5 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 pkg/website/urls.go diff --git a/cmd/flamenco-worker/find_exes.go b/cmd/flamenco-worker/find_exes.go index 45ef70d7..d14333ed 100644 --- a/cmd/flamenco-worker/find_exes.go +++ b/cmd/flamenco-worker/find_exes.go @@ -11,6 +11,7 @@ import ( "projects.blender.org/studio/flamenco/internal/find_blender" "projects.blender.org/studio/flamenco/internal/find_ffmpeg" + "projects.blender.org/studio/flamenco/pkg/website" ) // findFFmpeg tries to find FFmpeg, in order to show its version (if found) or a warning (if not). @@ -32,7 +33,7 @@ func findBlender() { defer cancel() helpMsg := "Flamenco Manager will have to supply the full path to Blender when tasks are sent " + - "to this Worker. For more info see https://flamenco.blender.org/usage/variables/blender/" + "to this Worker. For more info see " + website.DocVariablesURL result, err := find_blender.Find(ctx) switch { diff --git a/internal/manager/persistence/db_migration.go b/internal/manager/persistence/db_migration.go index 8b506d92..416c8a8f 100644 --- a/internal/manager/persistence/db_migration.go +++ b/internal/manager/persistence/db_migration.go @@ -10,6 +10,7 @@ import ( goose "github.com/pressly/goose/v3" "github.com/rs/zerolog/log" + "projects.blender.org/studio/flamenco/pkg/website" ) //go:embed migrations/*.sql @@ -41,7 +42,7 @@ func (db *DB) migrate(ctx context.Context) error { // files, so that it can't be forgotten. if err := db.pragmaForeignKeys(false); err != nil { - log.Fatal().AnErr("cause", err).Msg("could not disable foreign key constraints before performing database migrations, please report a bug at https://flamenco.blender.org/get-involved") + log.Fatal().AnErr("cause", err).Msgf("could not disable foreign key constraints before performing database migrations, please report a bug at %s", website.BugReportURL) } // Run Goose. @@ -52,7 +53,7 @@ func (db *DB) migrate(ctx context.Context) error { // Re-enable foreign key checks. if err := db.pragmaForeignKeys(true); err != nil { - log.Fatal().AnErr("cause", err).Msg("could not re-enable foreign key constraints after performing database migrations, please report a bug at https://flamenco.blender.org/get-involved") + log.Fatal().AnErr("cause", err).Msgf("could not re-enable foreign key constraints after performing database migrations, please report a bug at %s", website.BugReportURL) } return nil diff --git a/internal/worker/persistence/db_migration.go b/internal/worker/persistence/db_migration.go index 8b506d92..416c8a8f 100644 --- a/internal/worker/persistence/db_migration.go +++ b/internal/worker/persistence/db_migration.go @@ -10,6 +10,7 @@ import ( goose "github.com/pressly/goose/v3" "github.com/rs/zerolog/log" + "projects.blender.org/studio/flamenco/pkg/website" ) //go:embed migrations/*.sql @@ -41,7 +42,7 @@ func (db *DB) migrate(ctx context.Context) error { // files, so that it can't be forgotten. if err := db.pragmaForeignKeys(false); err != nil { - log.Fatal().AnErr("cause", err).Msg("could not disable foreign key constraints before performing database migrations, please report a bug at https://flamenco.blender.org/get-involved") + log.Fatal().AnErr("cause", err).Msgf("could not disable foreign key constraints before performing database migrations, please report a bug at %s", website.BugReportURL) } // Run Goose. @@ -52,7 +53,7 @@ func (db *DB) migrate(ctx context.Context) error { // Re-enable foreign key checks. if err := db.pragmaForeignKeys(true); err != nil { - log.Fatal().AnErr("cause", err).Msg("could not re-enable foreign key constraints after performing database migrations, please report a bug at https://flamenco.blender.org/get-involved") + log.Fatal().AnErr("cause", err).Msgf("could not re-enable foreign key constraints after performing database migrations, please report a bug at %s", website.BugReportURL) } return nil diff --git a/pkg/shaman/server.go b/pkg/shaman/server.go index 02e6b71f..3404654a 100644 --- a/pkg/shaman/server.go +++ b/pkg/shaman/server.go @@ -36,6 +36,7 @@ import ( "projects.blender.org/studio/flamenco/pkg/shaman/filestore" "projects.blender.org/studio/flamenco/pkg/shaman/jwtauth" "projects.blender.org/studio/flamenco/pkg/sysinfo" + "projects.blender.org/studio/flamenco/pkg/website" ) var ErrDoesNotExist = checkout.ErrDoesNotExist @@ -90,8 +91,8 @@ func checkPlatformSymlinkSupport() { switch { case err != nil: log.Warn().AnErr("cause", err). - Msg("unable to determine whether this platform can use symlinks. " + - "Please report a bug about this: https://flamenco.blender.org/development/get-involved/") + Msgf("unable to determine whether this platform can use symlinks. "+ + "Please report a bug about this: %s", website.BugReportURL) return case canSymlink: return @@ -100,8 +101,8 @@ func checkPlatformSymlinkSupport() { osDetail, err := sysinfo.Description() if err != nil { log.Warn().AnErr("cause", err). - Msg("unable to find details of your operating system. " + - "Please report a bug about this: https://flamenco.blender.org/development/get-involved/") + Msgf("unable to find details of your operating system. "+ + "Please report a bug about this: %s", website.BugReportURL) return } @@ -109,8 +110,8 @@ func checkPlatformSymlinkSupport() { Str("os", runtime.GOOS). Str("arch", runtime.GOARCH). Str("osDetail", osDetail). - Msg("this platform does not reliably support symbolic links, " + - "see https://flamenco.blender.org/usage/shared-storage/shaman/#requirements") + Msgf("this platform does not reliably support symbolic links, "+ + "see %s", website.ShamanRequirementsURL) } // Go starts goroutines for background operations. diff --git a/pkg/website/urls.go b/pkg/website/urls.go new file mode 100644 index 00000000..142ed4a7 --- /dev/null +++ b/pkg/website/urls.go @@ -0,0 +1,9 @@ +// package website contains references to the Flamenco website. +// Constants defined here can be used in the rest of Flamenco, for example for log messages. +package website + +const ( + DocVariablesURL = "https://flamenco.blender.org/usage/variables/blender/" + BugReportURL = "https://flamenco.blender.org/get-involved" + ShamanRequirementsURL = "https://flamenco.blender.org/usage/shared-storage/shaman/#requirements" +)