mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
Added font synchronizer configuration
Allows folks to disable the synchronizer in case folks don't want or don't need this functionality. Milestone: minor
This commit is contained in:
@@ -6,11 +6,15 @@ module Terminus
|
||||
module Synchronizers
|
||||
# Synchronizes TRMNL Framework fonts for local use.
|
||||
class Font < Base
|
||||
include Deps["aspects.fonts.synchronizer"]
|
||||
include Deps[:settings, "aspects.fonts.synchronizer"]
|
||||
|
||||
sidekiq_options queue: "within_1_minute"
|
||||
|
||||
def perform = synchronizer.call
|
||||
def perform
|
||||
return synchronizer.call if settings.font_synchronizer
|
||||
|
||||
logger.info { "Font synchronization is disabled." }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,6 +23,7 @@ module Terminus
|
||||
constructor: Types::Params::String,
|
||||
default: `git tag --list --sort=taggerdate | tail -n 1`.strip
|
||||
setting :firmware_synchronizer, constructor: Types::Params::Bool, default: true
|
||||
setting :font_synchronizer, constructor: Types::Params::Bool, default: true
|
||||
setting :http_timeout_connect,
|
||||
constructor: Types::Params::Integer.constrained(gt: 0),
|
||||
default: 2
|
||||
|
||||
@@ -36,6 +36,7 @@ There are several environment variables you can use to customize behavior by upd
|
||||
* `FERRUM_PROCESS_TIMEOUT`: Used for configuring {ferrum_link} headless browser time allowed for the browser to start. Default: `15`.
|
||||
* `FERRUM_JAVASCRIPT_ERRORS`: Used for configuring {ferrum_link} headless browser JavaScript errors. Default: `true`.
|
||||
* `FIRMWARE_SYNCHRONIZER`: Enables/disables firmware synchronization. See {doc_jobs_link} for details. Defaults to enabled.
|
||||
* `FONT_SYNCHRONIZER`: Enables/disables firmware synchronization. See {doc_jobs_link} for details. Defaults to enabled.
|
||||
* `FONTS_PATH`: The path to where {trmnl_framework_link} fonts are stored since the Framework stylesheets require a relative path to all fonts to load properly. This is necessary when rendering screens for {doc_extensions_link}. Default: `public/fonts`.
|
||||
* `HANAMI_MAX_THREADS`: The maximum number of threads allowed for {puma_link}. Default: `5`.
|
||||
* `HANAMI_MIN_THREADS`: The minimum number of threads allowed for {puma_link}. Default: `HANAMI_MAX_THREADS`.
|
||||
|
||||
+3
-2
@@ -8,7 +8,7 @@
|
||||
|
||||
All background jobs are handled by the Sidekiq worker service. Most are created via the UI but a few are launched at application boot. The following jobs cache data from our {trmnl_link} server for improved performance and to keep common records in sync:
|
||||
|
||||
* *Firmware*: Downloads the latest firmware for automatic device updates. By default, this checks for updates every six hours. In situations where your device updated to a newer Firmware version and it was a bad/broken version, you can revert to and older version by following these steps:
|
||||
* *Firmware*: Downloads the latest firmware for automatic device updates. By default, this checks for updates every six hours. In situations where your device updated to a newer Firmware version and was a bad/broken version, you can revert to an older version by following these steps:
|
||||
** Ensure the device you want to downgrade has firmware updates turned on (you'll also want to ensure devices you don't want to downgrade have this setting _turned off_).
|
||||
** Visit the Firmwares page within the UI.
|
||||
** Delete all latest versions until you only have the version you want to downgrade to listed at the top of the list.
|
||||
@@ -38,10 +38,11 @@ To disable any of the synchronizers, use the following environment variables:
|
||||
|
||||
----
|
||||
FIRMWARE_SYNCHRONIZER=0
|
||||
FONT_SYNCHRONIZER=0
|
||||
MODEL_SYNCHRONIZER=0
|
||||
----
|
||||
|
||||
You are not limited to using `0`. Any falsey value would work, example: `false`, "no", etc. When any of the pollers are disabled, you'll see the following messages in your logs (where `<poller>` is replaced with the specific poller that is disabled):
|
||||
You are not limited to using `0`. Any falsey value would work, example: `false`, "no", etc. When any of the synchronizers are disabled, you'll see the following messages in your logs (where `<synchronizer>` is replaced with the specific synchronizer that is disabled):
|
||||
|
||||
----
|
||||
<synchronizer> synchronization disabled.
|
||||
|
||||
@@ -7,10 +7,26 @@ RSpec.describe Terminus::Jobs::Synchronizers::Font do
|
||||
|
||||
let(:synchronizer) { instance_spy Terminus::Aspects::Fonts::Synchronizer }
|
||||
|
||||
include_context "with application dependencies"
|
||||
|
||||
describe "#perform" do
|
||||
it "calls synchronizer" do
|
||||
it "calls synchronizer when enabled" do
|
||||
job.perform
|
||||
expect(synchronizer).to have_received(:call)
|
||||
end
|
||||
|
||||
context "when disabled" do
|
||||
before { allow(settings).to receive(:font_synchronizer).and_return false }
|
||||
|
||||
it "doesn't call synchronizer" do
|
||||
job.perform
|
||||
expect(synchronizer).not_to have_received(:call)
|
||||
end
|
||||
|
||||
it "logs information" do
|
||||
job.perform
|
||||
expect(logger.reread).to match(/INFO.+Font synchronization is disabled\./)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user