Skip to content

Implement dynamic configuration via fragment-based templating - #6

Merged
flowzone-app[bot] merged 1 commit into
mainfrom
feat/weston-ini-templating
May 27, 2026
Merged

flowzone-app[bot] merged 1 commit into
mainfrom
feat/weston-ini-templating

Conversation

@rahul-thakoor

Copy link
Copy Markdown
Contributor

Migrate from a static weston.ini configuration to a flexible, fragment-based templating architecture using envsubst at container startup. This allows external configuration of Weston core and shell parameters via environment variables without requiring custom image rebuilds, facilitating the transition to a thin-client Wayland sidecar architecture.

  • Add configuration default fallbacks via weston-env-defaults.sh.
  • Split baseline settings into ordered templates under /etc/weston/templates/ (01-core.ini.template, 02-shell.ini.template, 03-libinput.ini.template).
  • Correct libinput key from 'enable-middle-button-emulation' to 'middle-button-emulation' to align with official Weston specifications.
  • Update entry.sh to conditionally execute envsubst across template fragments when WESTON_INI_PATH is unset.
  • Expose an escape hatch (WESTON_INI_PATH) to bypass dynamic generation and load a user-supplied static configuration file for advanced, multi-instance use cases (e.g., complex multi-output matrices).
  • Document environment variables, defaults, and advanced Dockerfile override patterns in README.md.

Change-type: minor

@flowzone-app
flowzone-app Bot enabled auto-merge May 15, 2026 14:21
@rahul-thakoor
rahul-thakoor force-pushed the feat/weston-ini-templating branch from 9db7f57 to 9bf79a6 Compare May 15, 2026 16:19
Migrate from a static `weston.ini` configuration to a flexible,
fragment-based templating architecture using envsubst at container
startup. This allows external configuration of Weston core and shell
parameters via environment variables without requiring custom image
rebuilds, facilitating the transition to a thin-client Wayland
sidecar architecture.

- Add configuration default fallbacks via weston-env-defaults.sh.
- Split baseline settings into ordered templates under /etc/weston/templates/
  (01-core.ini.template, 02-shell.ini.template, 03-libinput.ini.template).
- Correct libinput key from 'enable-middle-button-emulation' to
  'middle-button-emulation' to align with official Weston specifications.
- Update entry.sh to conditionally execute envsubst across template
  fragments when WESTON_INI_PATH is unset.
- Expose an escape hatch (WESTON_INI_PATH) to bypass dynamic generation
  and load a user-supplied static configuration file for advanced,
  multi-instance use cases (e.g., complex multi-output matrices).
- Document environment variables, defaults, and advanced
  Dockerfile override patterns in README.md.
- Install gettext-base to provide the envsubst binary required for runtime

Change-type: minor
Signed-off-by: Rahul Thakoor <rahul@balena.io>
@rahul-thakoor
rahul-thakoor force-pushed the feat/weston-ini-templating branch from 9bf79a6 to 5db4908 Compare May 16, 2026 01:57
@rahul-thakoor

Copy link
Copy Markdown
Contributor Author

Tests


Test 1: Baseline, no env vars configured

when no configuration environment variables are explicitly defined, the entry script generates weston.ini based on defaults

Logs:

Setting up XDG_RUNTIME_DIR at /run/user/0...
INFO: Generating dynamic weston.ini from template fragments...
--- LAUNCHING WESTON ---
Command: exec weston --socket=wayland-0 --config=/run/user/0/weston/weston.ini
Date: 2026-05-16 UTC
[02:49:48.351] weston 14.0.2
              https://wayland.freedesktop.org
              Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
              Build: 14.0.2
[02:49:48.351] Command line: weston --socket=wayland-0 --config=/run/user/0/weston/weston.ini
[02:49:48.351] OS: Linux, 6.12.47-yocto-standard, #1 SMP Mon Sep 15 02:39:40 UTC 2025, aarch64

cat /run/user/0/weston/weston.ini

[core]
shell=kiosk
idle-time=0
require-input=false

[shell]
locking=false
panel-position=none

[libinput]
enable-tap=true
middle-button-emulation=true
image

Test 2: Configure WESTON_INI_CORE_SHELL=desktop

image
cat /run/user/0/weston/weston.ini 
[core]
shell=desktop
idle-time=0
require-input=false
[shell]
locking=false
panel-position=none

[libinput]
enable-tap=true
middle-button-emulation=true
image

Test 3: Multi env Vars

WESTON_INI_CORE_SHELL=desktop
WESTON_INI_SHELL_PANEL_POSITION=bottom
image image

Test 4: Set WESTON_INI_PATH

4.1 Missing File

if WESTON_INI_PATH is designated but no file exists at that target location, the entrypoint falls back to generating dynamic template

Setting up XDG_RUNTIME_DIR at /run/user/0...
INFO: Generating dynamic weston.ini from template fragments...
--- LAUNCHING WESTON ---
Command: exec weston --socket=wayland-0 --config=/run/user/0/weston/weston.ini

4.2 WESTON_INI_PATH Env var set and target file exists

FROM bh.cr/balena_solutions/display-%%BALENA_ARCH%%/0.1.0-1778896713634

COPY weston.ini /etc/weston/weston.ini
  • cat /etc/weston/weston.ini
[core]
shell=desktop
idle-time=0
require-input=false

[shell]
locking=false
panel-position=right

[libinput]
enable-tap=true
middle-button-emulation=true

runtime env vars check:

root@43e8941:/# printenv | grep WESTON
WESTON_INI_SHELL_PANEL_POSITION=bottom
WESTON_INI_CORE_SHELL=kiosk
WESTON_INI_PATH=/etc/weston/weston.ini

Logs:

Setting up XDG_RUNTIME_DIR at /run/user/0...
INFO: WESTON_INI_PATH is set. Bypassing dynamic template generation.
INFO: Using static configuration file at: /etc/weston/weston.ini
--- LAUNCHING WESTON ---
Command: exec weston --socket=wayland-0 --config=/etc/weston/weston.ini

Note: WESTON_INI_SHELL_PANEL_POSITION=bottom and WESTON_INI_CORE_SHELL=kiosk variables were successfully ignored; panel-position=right from /etc/weston/weston.ini was applied

image

@rahul-thakoor
rahul-thakoor requested a review from alanb128 May 16, 2026 07:20
@rahul-thakoor
rahul-thakoor requested a review from chrisys May 27, 2026 12:00

@chrisys chrisys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with/without env vars and a custom ini file in a random location - all works as expected.

@flowzone-app
flowzone-app Bot merged commit bf527d9 into main May 27, 2026
49 checks passed
@flowzone-app
flowzone-app Bot deleted the feat/weston-ini-templating branch May 27, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants