godotenv multiline env vars and unexpected tokens #6
Closed
opened 2021-07-20 22:50:08 +00:00 by decentral1se
·
7 comments
No Branch/Tag Specified
main
fix/492
local-integration-testing
renovate/github.com-charmbracelet-lipgloss-2.x
renovate/otel-weaver-0.x
renovate/codespell-2.x
renovate/github.com-charmbracelet-bubbletea-2.x
renovate/tonistiigi-xx-1.x
renovate/alpine-3.x
renovate/github.com-charmbracelet-log-2.x
chore-deps
fix/deps
fix/613
0.13.0-beta
0.13.0-rc2-beta
0.13.0-rc1-beta
0.12.0-beta
0.11.0-beta
0.10.1-beta
0.10.0-beta
0.10.0-rc2-beta
0.10.0-rc1-beta
0.9.0-beta
0.8.1-beta
0.8.0-beta
0.8.0-rc2-beta
0.8.0-rc1-beta
0.7.0-beta
0.7.0-rc3-beta
0.7.0-rc2-beta
0.6.0-beta
0.5.1-beta
0.5.0-alpha
0.4.1-alpha
0.4.0-alpha
0.4.0-alpha-rc8
0.4.0-alpha-rc7
0.4.0-alpha-rc6
0.4.0-alpha-rc5
0.4.0-alpha-rc4
0.4.0-alpha-rc3
0.4.0-alpha-rc2
0.4.0-alpha-rc1
0.3.1-alpha-rc2
0.3.1-alpha-rc1
0.3.1-rc1
0.3.0-alpha
0.2.2-alpha
0.2.1-alpha
0.2.0-alpha
0.1.8-alpha
0.1.7-alpha
0.1.6-alpha
0.1.5-alpha
0.1.4-alpha
0.1.3-alpha
0.1.2-alpha
0.1.1-alpha
0.1.0-alpha
10.0.5
10.0.3
10.0.2
10.0.1
10.0.0
9.0.0
8.0.1
8.0.0
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
checkout
0.6.0
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.0
0.1.2
0.1.1
0.1.0
Labels
Clear labels
bug
build
ci/cd
critical fix
design
documentation
duplicate
easy-first-issue
enhancement
help wanted
i10n
i18n
installer
invalid
question
release
release-candidate
security
tech-debt
test
wontfix
Something is not working
go build related issues
Building things with CI/CD
https://docs.coopcloud.tech/federation/resolutions/passed/010/
UI/UX
Documenting all the things
This issue or pull request already exists
Something for new people to get stuck into. We hope it's easy!
New feature
Need some help
Everything to do with localisation
Everything to do with internationalisation
Everything to do with the install script.
Something is wrong
More information is needed
Release management
Related to the new release candidate
Security related
Unit/integration testing
This won't be fixed
No labels
help wanted
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
3wordchant
aadil (Aadil Ayub)
abra-bot (Abra Bot)
ammaratef45
amras (Sarma)
Apfelwurm
BornDeleuze
Brooke
carla
cas (Cassowary)
coopcloud
cyrnel
decentral1se (d1)
dede
devydave
fauno (fauno)
iexos
jade (Jade Ambrose)
jjsfunhouse
jmakdah2 (Jackie Makdah)
joe-irving (Joe Irving)
kawaiipunk (KawaiiPunk)
knoflook
kolaente
lambdabundesverband
linnealovespie (April)
moosemower
moritz
notplants
oxaliq (sorrel)
p4u1
pharaohgraphy (Andrew 🐦🔥❤️🔥✴️)
renovate-bot (Comrade Renovate Bot)
ripclap
simon
sixsmith (Sixsmith)
stevensting
trav (Trav Fryer)
val (val (he/him))
yksflip
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: toolshed/abra#6
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
While learning/testing
abra app lsI ran into the issue mention in with multiline env vars. The following diff seemed to work, pointing to the mentioned fork temporarily. A few env files have multi-line requirements, so it seems we need this.Also, I raised https://github.com/joho/godotenv/issues/150 for another issue. Maybe we need to publish a patch to fix this also?
Godotenv seems quite nice but also kinda buggy. Don't see any alternative right now.
Oh wait, https://github.com/spf13/viper also supports
dotenvformat... however, it doesn't support multi-line env vars 😢 I see they are using the underyling https://github.com/subosito/gotenv library which would have to implement multi-line support too.I wonder is this a sign to migrate to YAML? I was able to parse the following using viper:
This may be going on a total tangent but I could imagine we could re-work some of the format of the
.envfile to be less confusing and based on bash-isms? For example, how secrets are managed.From our Gitea configs:
Could be:
Which would be more intuitive since you use those names in the
compose.ymlfile. Then we could change lines likename: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}to something less verbose likename: ${DB_PASSWORD_SECRET}because we have more programmatic control on the loading?We had originally went with env format because it was easier but maybe it is worth reconsidering this now?
I think moving to Viper and then doing what makes sense for the situation is the best way forward sindi it seems to support everything. I will move it to Viper and then we can work on the config later.
Out-band-logs lead to a switch to koanf due to:
I consider this fixed for now with
0242dfcb0f. Wanna make sure I am not jumping the gun on that. When it comes to like what to do with dealing with apps .env files I think we can make a new issue for this if thats ok with you @decentral1se?💯
@decentral1se @roxxers I think I'm sold on the benefits of YAML -- the one thing we'll lose is the ability to pick up the config files using vanilla Docker, because AFAIK Docker only supports env files.
Maybe we don't need to give as much assurance to folks for the "whoops Co-op Cloud disappeared" situation now that we're becoming more of a thing? But if that still does feel useful, maybe the solution is a new command that can export an app config in env format?