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.
This commit is contained in:
Sybren A. Stüvel 2024-01-25 12:25:06 +01:00
parent 13a793743f
commit 70faa4e225
5 changed files with 24 additions and 11 deletions

@ -11,6 +11,7 @@ import (
"projects.blender.org/studio/flamenco/internal/find_blender" "projects.blender.org/studio/flamenco/internal/find_blender"
"projects.blender.org/studio/flamenco/internal/find_ffmpeg" "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). // 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() defer cancel()
helpMsg := "Flamenco Manager will have to supply the full path to Blender when tasks are sent " + 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) result, err := find_blender.Find(ctx)
switch { switch {

@ -10,6 +10,7 @@ import (
goose "github.com/pressly/goose/v3" goose "github.com/pressly/goose/v3"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"projects.blender.org/studio/flamenco/pkg/website"
) )
//go:embed migrations/*.sql //go:embed migrations/*.sql
@ -41,7 +42,7 @@ func (db *DB) migrate(ctx context.Context) error {
// files, so that it can't be forgotten. // files, so that it can't be forgotten.
if err := db.pragmaForeignKeys(false); err != nil { 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. // Run Goose.
@ -52,7 +53,7 @@ func (db *DB) migrate(ctx context.Context) error {
// Re-enable foreign key checks. // Re-enable foreign key checks.
if err := db.pragmaForeignKeys(true); err != nil { 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 return nil

@ -10,6 +10,7 @@ import (
goose "github.com/pressly/goose/v3" goose "github.com/pressly/goose/v3"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"projects.blender.org/studio/flamenco/pkg/website"
) )
//go:embed migrations/*.sql //go:embed migrations/*.sql
@ -41,7 +42,7 @@ func (db *DB) migrate(ctx context.Context) error {
// files, so that it can't be forgotten. // files, so that it can't be forgotten.
if err := db.pragmaForeignKeys(false); err != nil { 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. // Run Goose.
@ -52,7 +53,7 @@ func (db *DB) migrate(ctx context.Context) error {
// Re-enable foreign key checks. // Re-enable foreign key checks.
if err := db.pragmaForeignKeys(true); err != nil { 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 return nil

@ -36,6 +36,7 @@ import (
"projects.blender.org/studio/flamenco/pkg/shaman/filestore" "projects.blender.org/studio/flamenco/pkg/shaman/filestore"
"projects.blender.org/studio/flamenco/pkg/shaman/jwtauth" "projects.blender.org/studio/flamenco/pkg/shaman/jwtauth"
"projects.blender.org/studio/flamenco/pkg/sysinfo" "projects.blender.org/studio/flamenco/pkg/sysinfo"
"projects.blender.org/studio/flamenco/pkg/website"
) )
var ErrDoesNotExist = checkout.ErrDoesNotExist var ErrDoesNotExist = checkout.ErrDoesNotExist
@ -90,8 +91,8 @@ func checkPlatformSymlinkSupport() {
switch { switch {
case err != nil: case err != nil:
log.Warn().AnErr("cause", err). log.Warn().AnErr("cause", err).
Msg("unable to determine whether this platform can use symlinks. " + Msgf("unable to determine whether this platform can use symlinks. "+
"Please report a bug about this: https://flamenco.blender.org/development/get-involved/") "Please report a bug about this: %s", website.BugReportURL)
return return
case canSymlink: case canSymlink:
return return
@ -100,8 +101,8 @@ func checkPlatformSymlinkSupport() {
osDetail, err := sysinfo.Description() osDetail, err := sysinfo.Description()
if err != nil { if err != nil {
log.Warn().AnErr("cause", err). log.Warn().AnErr("cause", err).
Msg("unable to find details of your operating system. " + Msgf("unable to find details of your operating system. "+
"Please report a bug about this: https://flamenco.blender.org/development/get-involved/") "Please report a bug about this: %s", website.BugReportURL)
return return
} }
@ -109,8 +110,8 @@ func checkPlatformSymlinkSupport() {
Str("os", runtime.GOOS). Str("os", runtime.GOOS).
Str("arch", runtime.GOARCH). Str("arch", runtime.GOARCH).
Str("osDetail", osDetail). Str("osDetail", osDetail).
Msg("this platform does not reliably support symbolic links, " + Msgf("this platform does not reliably support symbolic links, "+
"see https://flamenco.blender.org/usage/shared-storage/shaman/#requirements") "see %s", website.ShamanRequirementsURL)
} }
// Go starts goroutines for background operations. // Go starts goroutines for background operations.

9
pkg/website/urls.go Normal file

@ -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"
)