lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.91k stars 269 forks source link

Space character in .env file #587

Closed Dani20000 closed 1 year ago

Dani20000 commented 1 year ago

Can I suggest to add the space character to the translation table? I'm honestly not 100% sure that this small change in the "_PRE_TRANSLATE" dictionary is enough to add it, i'm a python (and docker) beginner, but there's no harm in trying.

I'm actually using the POST_BEPINEX_CONFIG_HOOK event hook and env2cfg to create/modify some configs for some plugins. The config "neanka.def_handy_portals.cfg" (from "Handy portals" plugin) is using space character in his section names so docker gives me the error "key cannot contain a space" when using docker compose up.

For example, this is a part of the config:

## Settings file was created by plugin DEF handy portals v1.0.0.7
## Plugin GUID: neanka.def_handy_portals

[Cheat]

## Allow teleport with restricted items
# Setting type: Boolean
# Default value: false
Allow teleport with restricted items = false

This, in the .env file, doesn't work and docker gives the error "key cannot contain a space":

POST_BEPINEX_CONFIG_HOOK=env2cfg --verbose --config /config/bepinex/neanka.def_handy_portals.cfg --env-prefix HANDYPORTALS_
HANDYPORTALS_Cheat_Allow teleport with restricted items=true

Adding the space character in the Translation table should allow something like this to work:

POST_BEPINEX_CONFIG_HOOK=env2cfg --verbose --config /config/bepinex/neanka.def_handy_portals.cfg --env-prefix HANDYPORTALS_
HANDYPORTALS_Cheat_Allow_SPACE_teleport_SPACE_with_SPACE_restricted_SPACE_items=true

Thank you for your time 😄

lloesche commented 1 year ago

Hi @Dani20000, thank you for your PR. Looks good to me! 🚢 👍