From dfdb8e82a1a9b01903ee86aee2e2ac05067ef64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 22 Feb 2024 12:38:13 +0100 Subject: [PATCH] Worker: Refer to website instead of non-existent example file The worker-written config files would all refer to `flamenco-worker-example.yaml`, even though this file doesn't even exist. Instead, the configuration file will refer to the appropriate documentation on the website, and the credentials file will explain what happens when you delete it. The credentials are otherwise intentionally left undocumented, as their contents are not to be manually edited. The only thing to do with that file is delete it so that the Worker re-registers itself at startup. --- internal/worker/config.go | 14 ++++++++++++-- pkg/website/urls.go | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/worker/config.go b/internal/worker/config.go index 7d1d8b00..0ad0d6eb 100644 --- a/internal/worker/config.go +++ b/internal/worker/config.go @@ -16,6 +16,7 @@ import ( "github.com/rs/zerolog/log" yaml "gopkg.in/yaml.v2" "projects.blender.org/studio/flamenco/internal/appinfo" + "projects.blender.org/studio/flamenco/pkg/website" ) var ( @@ -177,9 +178,18 @@ func (fcw FileConfigWrangler) writeConfig(filename string, filetype configFileTy return err } fmt.Fprintf(f, "# %s file for Flamenco Worker.\n", filetype) - fmt.Fprintln(f, "# For an explanation of the fields, refer to flamenco-worker-example.yaml") fmt.Fprintln(f, "#") - fmt.Fprintln(f, "# NOTE: this file can be overwritten by Flamenco Worker.") + switch filetype { + case configFileTypeConfiguration: + fmt.Fprintf(f, "# For an explanation of the fields, refer to %s\n", website.WorkerConfigURL) + case configFileTypeCredentials: + fmt.Fprintln(f, "# This file is not meant to be manually edited. Removing this file is fine, and") + fmt.Fprintln(f, "# will cause the Worker to re-register as a new Worker.") + fmt.Fprintln(f, "#") + fmt.Fprintf(f, "# For more information, refer to %s\n", website.WorkerConfigURL) + } + fmt.Fprintln(f, "#") + fmt.Fprintln(f, "# NOTE: this file may be overwritten by Flamenco Worker.") fmt.Fprintln(f, "#") now := time.Now() fmt.Fprintf(f, "# This file was written on %s\n\n", now.Format("2006-01-02 15:04:05 -07:00")) diff --git a/pkg/website/urls.go b/pkg/website/urls.go index a8602014..1b0df789 100644 --- a/pkg/website/urls.go +++ b/pkg/website/urls.go @@ -7,4 +7,5 @@ const ( WorkerCredsUnknownHelpURL = "https://flamenco.blender.org/faq/#what-does-unknown-worker-is-trying-to-communicate-mean" BugReportURL = "https://flamenco.blender.org/get-involved" ShamanRequirementsURL = "https://flamenco.blender.org/usage/shared-storage/shaman/#requirements" + WorkerConfigURL = "https://flamenco.blender.org/usage/worker-configuration/" )