itzg / itzg/docker-minecraft-server
Replace comma-separated envvars with comma+whitespace separated envvars
- 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
Seems like there are some envvars that split on commas, some on commas+newlines, some on commas+whitespace, and others on just whitespace. I propose replacing all of the first type with comma+whitespace splits unless they rely on newlines being retained (which I don't see being an issue). In places where commas are required (e.g. in [mc-image-helper](https://github.com/itzg/mc-image-helper#mcopy), and are they really required?), values can first be split on commas+whitespace, then re-joined on commas:
```sh
IFS=,$IFS # prepend comma to $IFS
plugins=($PLUGINS) # split on $IFS (comma+whitespace)
mc-image-helper mcopy ... "$*" # join with comma
IFS=${IFS#?} # restore $IFS
```
The motivation behind this issue is this snippet from my docker-compose.yml:
```yaml
SPIGET_RESOURCES:
# spark,discordsrv,deathchest,pluginmanager,spark,veinminer #,vault,essentialsx
57242,18494,101066,69061,57242,12038 #,34315,9089
```
Notice how I accidentally duplicated one of the plugins. Ignoring how cryptic YAML multiline indicators are, I would prefer to write this instead:
```yaml
SPIGET_RESOURCES: >-
57242 # spark
18494 # discordsrv
101066 # deathchest
69061 # pluginmanager
12038 # veinminer
#34315 # vault
#9089 # essentialsx
```
I can work on a PR for this if we're in agreement!
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no files or tests. Start by searching the repository for environment-variable parsing and comma-splitting, then inventory which variables use each delimiter style. Compare the existing behavior with the SPIGET_RESOURCES example and mc-image-helper case; done means compatible existing configurations while supporting comma-plus-whitespace-separated values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100