Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker_setup #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update docker_setup #189

wants to merge 1 commit into from

Conversation

deni64k
Copy link

@deni64k deni64k commented May 19, 2023

base64 outputs a multiline string.

JWT_SECRET part in docker.env looks like this:

JWT_SECRET=CUUFOda1RFKQm+yn7lonersUsLtiCo+fU+NCnbjGAvRj5YQzMOXC8CUWg5OVWyCPw/5g6Ez4sqfZ
MkQg1FlmWenhqmdbxCkWe5rwl4IK1286H+uXvVw+Uz5uzZyyTVTTQl57TLPAjbRsxPGnSXFxf/2r
uuDCp75NKfRZvItL0GW8SiVhTUwWW0mo1WhYGsDGZ3rljThK8FunxNyd9l/c6hG9ETt6uFCQVx/H
N/Iu7nkbp/zPzrK8mXfKrumL6

Then, docker-compose can't load such docker.env because of + symbol.

`base64` outputs as a multiline string.

`JWT_SECRET` part in `docker.env` looks like this:
```
JWT_SECRET=abc
a+c
bcd
bas
```

Then, `docker-compose` can't load such `docker.env` because of `+` symbol.
@sheim-dev
Copy link

The fix suggested in this PR is needlessly complex. It uses tr to remove newlines from the token that base64 should be prevented from inserting in the first place by providing the -w 0 option to it like this:

index 4578aa3..369e279 100755
--- a/docker_setup
+++ b/docker_setup
@@ -2,7 +2,7 @@
 
 postgresPassword=$(cat /dev/urandom | base64 | head -c 64)
 retooldbPostgresPassword=$(cat /dev/urandom | base64 | head -c 64)
-jwtSecret=$(cat /dev/urandom | base64 | head -c 256)
+jwtSecret=$(cat /dev/urandom | base64 -w 0 | head -c 256)
 encryptionKey=$(cat /dev/urandom | base64 | head -c 64)
 publicIpAddress=$(dig +short myip.opendns.com @resolver1.opendns.com)

@deni64k
Copy link
Author

deni64k commented Dec 18, 2023

@sheim-dev option -w is not available on every system. BSD version of base64 doesn't have it. Using tr is portable,

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