Configure logo, logo_small as code

Dear discourse community.

I recently automated the deployment and restoring of production backup to a dev and test instance of the discourse forum.
This allows to have identical data on all sites.
Yet I would like to customize the site logo depending on the instance.

following up this site_setting.yml as advertized in this other topic:Comprehensive list of SiteSettings?

I was able to configure key settings of the sites with different variables.
Yet the logo part is not very well documented, so I tried several approach.

...
# Available options:
#
# default               - The default value of the setting. For upload site settings, use the id of the upload seeded
#                         in db/fixtures/010_uploads.rb.
...

branding:
  logo:
    default: -5
    client: true
    type: upload
  logo_small:
    default: -6
    client: true
    type: upload

Basically the default seems to be an integer index as defined int he 010_uploads.rb:

  -5 => "discourse-logo-sketch.png",
  -6 => "discourse-logo-sketch-small.png",

In the UI setting history I found the reference to the latest logo and logo_small as links to the /upload directory.

e.g.: /uploads/default/original/3X/2/4/242dc879cbffed41ee64646a0dffded5c34bb9c6.png

In my app setting .yml I then started by experimenting with the default value:

  # Backup
  DISCOURSE_s3_backup_bucket: "backup-test"

  # Logo
  DISCOURSE_logo: -5
  DISCOURSE_logo_small: -6

Setting up DISCOURSE_logo and DISCOURSE_logo_small to the default as specified in the site_settings.yml

rebuilding the site did cause some 500 and the site was not operational anymore.
I also tried to pass on a string reference to the upload I would like to be the logo of this specific site, unfortunatelly the same effect, an unusable site.

DISCOURSE_logo: "/uploads/default/original/3X/2/4/242dc879cbffed41ee64646a0dffded5c34bb9c6.png"

My chain of thoughts was to upload different logos for dev, test and prod on the prod instance then after restoring the productive backup ensure the site rebuild will point to the correct logo for the specific instance.

Any help would greatly be appreciated.

1 Like