-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Add Docker Secrets Support #161
Open
GAS85
wants to merge
2
commits into
vogler:main
Choose a base branch
from
GAS85:dockerSecrets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
# start with `docker compose up` | ||
version: "3.7" | ||
|
||
secrets: | ||
vnc_password: | ||
file: .secrets/vnc_password_common | ||
epic_user: | ||
file: .secrets/epic_user | ||
epic_password: | ||
file: .secrets/epic_password | ||
epic_otp: | ||
file: .secrets/epic_otp | ||
|
||
services: | ||
free-games-claimer: | ||
container_name: fgc # is printed in front of every output line | ||
image: ghcr.io/vogler/free-games-claimer # otherwise image name will be free-games-claimer-free-games-claimer | ||
build: . | ||
ports: | ||
# - "5900:5900" # VNC server | ||
- "6080:6080" # noVNC (browser-based VNC client) | ||
|
@@ -13,3 +24,30 @@ services: | |
environment: | ||
# - [email protected] | ||
# - NOTIFY='tgram://...' | ||
# - NOTIFY_TITLE="Optional title for notifications" | ||
# - VNC_PASSWORD="VNC Password" | ||
- VNC_PASSWORD_FILE=/run/secrets/vnc_password | ||
# - BROWSER_DIR="data/browser" | ||
# - TIMEOUT="60" | ||
# - LOGIN_TIMEOUT="80" | ||
# - EMAIL="Default email for any login" | ||
# - PASSWORD="Default password for any login" | ||
# - EG_EMAIL="Epic Games email for login" | ||
# - EG_PASSWORD="Epic Games password for login" | ||
# - EG_OTPKEY="Epic Games MFA OTP key" | ||
- EG_EMAIL_FILE=/run/secrets/epic_user | ||
- EG_PASSWORD_FILE=/run/secrets/epic_password | ||
- EG_OTPKEY_FILE=/run/secrets/epic_otp | ||
# - EG_PARENTALPIN="Epic Games Parental Controls PIN" | ||
# - PG_EMAIL="Prime Gaming email for login" | ||
# - PG_PASSWORD="Prime Gaming password for login" | ||
# - PG_OTPKEY="Prime Gaming MFA OTP key" | ||
# - PG_REDEEM="0" | ||
# - PG_CLAIMDLC="0" | ||
# - GOG_EMAIL="GOG email for login" | ||
# - GOG_PASSWORD="GOG Password" | ||
secrets: | ||
- epic_user | ||
- epic_password | ||
- epic_otp | ||
- vnc_password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,34 @@ rm -f /fgc/data/browser/SingletonLock | |
# ls -l /tmp/.X11-unix/ | ||
rm -f /tmp/.X1-lock | ||
|
||
# Check and export secrets to variables if exist | ||
# Get list of VARIABLES with "_FILE" at the end | ||
SECRETS_LIST=$(env | grep "_FILE") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought also to limit those to only credentials and add here whitelist, e.g.
|
||
if [ ! -z "$SECRETS_LIST" ]; then | ||
|
||
echo "Secrets were found, will try to convert them into the Variables..." | ||
|
||
# Will read one by one, remove "_FILE" from the end and get value from the file | ||
# Known bug: if you set "=" in the variable value, it will be converted to the space | ||
while read SECRETS; do | ||
SECRET_VALUE=$(echo $SECRETS | awk -F'[=]' '{ $1=""; print $0 }') | ||
# Remove unneeded space at the begging | ||
SECRET_VALUE=${SECRET_VALUE:1} | ||
SECRET_NAME=$(echo $SECRETS | awk -F'[=]' '{ print $1 }') | ||
# Remove "_FILE" at the end of the Variable Name | ||
SECRET_NAME=${SECRET_NAME::-5} | ||
|
||
# If file with value readable, use it to fetch value and export variable | ||
if [ -r "$SECRET_VALUE" ]; then | ||
echo "Setting $SECRET_NAME with value from $SECRET_VALUE" | ||
export "$SECRET_NAME"="$(cat "$SECRET_VALUE")" | ||
else | ||
echo "ERROR - $SECRETS is configured, but file not exist or not readable." | ||
fi | ||
done <<< $SECRETS_LIST | ||
|
||
fi | ||
|
||
# 6000+SERVERNUM is the TCP port Xvfb is listening on: | ||
# SERVERNUM=$(echo "$DISPLAY" | sed 's/:\([0-9][0-9]*\).*/\1/') | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want another place to keep options in sync besides
config.js
andREADME.md
.Is this useful for some software to offer a template? (There's already some external Unraid template.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good wish. I can remove them, but at least compose example should be copy-paste working, so that it contains basic needed data.