itzg / itzg/docker-minecraft-server

Allow shell expansion style defaults in variable replacements

Open
#1,564 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Shell
Stars
14.3k
Forks
1.9k
Avg merge
2d 10h
Merged PRs (30d)
31

Description

### Enhancement Type

Improve an existing feature

### Describe the enhancement

Currently, the [variable replacement](https://github.com/itzg/docker-minecraft-server#replacing-variables-inside-configs) mechanism has no option to define defaults inline; this means all parameters you add become required inputs and a breaking change to your configuration.
I propose we allow default values to be defined in a similar style to [bash parameter expansion](https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html) `§{CFG_USERNAME:-root}`.
Wether or not you want to be fully compliant with all of the various intricacies of bash parameter expansion is on the table, but default values are more than enough for my use case.

Perhaps the only other potentially useful mechanism is the ability to use a different variable as the default. This would be useful in situations like this where you have a global variable, but also want to expose granularity for specific use cases `${CFG_FORGE_LOGLEVEL:=CFG_LOGLEVEL}`.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the variable replacement documentation linked in the issue, then locate the shell-based implementation that processes those replacements. Clarify whether the required scope is simple inline defaults such as `${CFG_USERNAME:-root}` or also variable-to-variable defaults. Done means supported default syntax works without requiring the parameter, with tests covering the documented examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, shell
Domain
devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.