-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Control PIA and Transmission from env vars #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,37 @@ then | |
if [ -f /etc/openvpn/"${OPEN_VPN_CONFIG}".ovpn ] | ||
then | ||
echo "Starting OpenVPN using config ${OPEN_VPN_CONFIG}.ovpn" | ||
exec openvpn --config /etc/openvpn/"${OPEN_VPN_CONFIG}".ovpn | ||
OPEN_VPN_CONFIG=/etc/openvpn/${OPEN_VPN_CONFIG}.ovpn | ||
else | ||
echo "Supplied config ${OPEN_VPN_CONFIG}.ovpn could not be found." | ||
echo "Using default OpenVPN gateway: Netherlands" | ||
exec openvpn --config /etc/openvpn/Netherlands.ovpn | ||
OPEN_VPN_CONFIG=/etc/openvpn/Netherlands.ovpn | ||
fi | ||
else | ||
echo "No VPN configuration provided. Using default: Netherlands" | ||
exec openvpn --config /etc/openvpn/Netherlands.ovpn | ||
OPEN_VPN_CONFIG=/etc/openvpn/Netherlands.ovpn | ||
fi | ||
|
||
# override resolv.conf | ||
if [ "$RESOLV_OVERRIDE" != "**None**" ]; | ||
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. Don't have to init env variables as None, can just check for empty 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. Actually did this by design. Totally ok if you don't what it there. I like to have it there as a kind of reminder that the option is available. Some services will read the ENV vars from the Dockerfile and show them to the user (tutum.co). But if you don't want it there no worries at all :-) 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. Ah ok, did not know that. Just thought it looked verbose. But, then it has a purpose :) |
||
then | ||
echo "Overriding resolv.conf..." | ||
printf "$RESOLV_OVERRIDE" > /etc/resolv.conf | ||
fi | ||
|
||
# add PIA user/pass | ||
if [ "$PIA_USERNAME" != "**None**" ]; | ||
then | ||
echo "Setting PIA credentials..." | ||
mkdir -p /config | ||
echo $PIA_USERNAME > /config/pia-credentials.txt | ||
echo $PIA_PASSWORD >> /config/pia-credentials.txt | ||
else | ||
echo "Not setting PIA credentials." | ||
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. Should probably not allow startup without credentials. Thinking exit here... 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. 👍 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. Fixed in faa3972 |
||
fi | ||
|
||
dockerize \ | ||
-template /etc/transmission-daemon/settings.json:/etc/transmission-daemon/settings.json \ | ||
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. Setting transmission-daemon setting from environment variables. Then, if the port updater should when TRANSMISSION_RPC_AUTHENTICATION_REQUIRED is set to true, the updater should also read the environment variables 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. Good idea! 👍 |
||
true | ||
|
||
exec openvpn --config "$OPEN_VPN_CONFIG" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,74 @@ | ||
{ | ||
"alt-speed-down": 50, | ||
"alt-speed-enabled": false, | ||
"alt-speed-time-begin": 540, | ||
"alt-speed-time-day": 127, | ||
"alt-speed-time-enabled": false, | ||
"alt-speed-time-end": 1020, | ||
"alt-speed-up": 50, | ||
"bind-address-ipv4": "0.0.0.0", | ||
"bind-address-ipv6": "::", | ||
"blocklist-enabled": false, | ||
"blocklist-url": "http://www.example.com/blocklist", | ||
"cache-size-mb": 4, | ||
"dht-enabled": true, | ||
"download-dir": "/data/completed", | ||
"download-limit": 100, | ||
"download-limit-enabled": 0, | ||
"download-queue-enabled": true, | ||
"download-queue-size": 5, | ||
"encryption": 1, | ||
"idle-seeding-limit": 30, | ||
"idle-seeding-limit-enabled": false, | ||
"incomplete-dir": "/data/incomplete", | ||
"incomplete-dir-enabled": true, | ||
"lpd-enabled": false, | ||
"max-peers-global": 200, | ||
"message-level": 2, | ||
"peer-congestion-algorithm": "", | ||
"peer-id-ttl-hours": 6, | ||
"peer-limit-global": 200, | ||
"peer-limit-per-torrent": 50, | ||
"peer-port": 51413, | ||
"peer-port-random-high": 65535, | ||
"peer-port-random-low": 49152, | ||
"peer-port-random-on-start": false, | ||
"peer-socket-tos": "default", | ||
"pex-enabled": true, | ||
"port-forwarding-enabled": false, | ||
"preallocation": 1, | ||
"prefetch-enabled": 1, | ||
"queue-stalled-enabled": true, | ||
"queue-stalled-minutes": 30, | ||
"ratio-limit": 2, | ||
"ratio-limit-enabled": false, | ||
"rename-partial-files": true, | ||
"rpc-authentication-required": false, | ||
"rpc-bind-address": "0.0.0.0", | ||
"rpc-enabled": true, | ||
"rpc-password": "{425745bf3914984c2abcc013276f40e8fa5d84ecC5.df8oF", | ||
"rpc-port": 9091, | ||
"rpc-url": "/transmission/", | ||
"rpc-username": "username", | ||
"rpc-whitelist": "127.0.0.1", | ||
"rpc-whitelist-enabled": false, | ||
"scrape-paused-torrents-enabled": true, | ||
"script-torrent-done-enabled": false, | ||
"script-torrent-done-filename": "", | ||
"seed-queue-enabled": false, | ||
"seed-queue-size": 10, | ||
"speed-limit-down": 100, | ||
"speed-limit-down-enabled": false, | ||
"speed-limit-up": 100, | ||
"speed-limit-up-enabled": false, | ||
"start-added-torrents": true, | ||
"trash-original-torrent-files": false, | ||
"umask": 2, | ||
"upload-limit": 100, | ||
"upload-limit-enabled": 0, | ||
"upload-slots-per-torrent": 14, | ||
"utp-enabled": true, | ||
"watch-dir": "/data/watch", | ||
"watch-dir-enabled": true | ||
"alt-speed-down": {{ .Env.TRANSMISSION_ALT_SPEED_DOWN }}, | ||
"alt-speed-enabled": {{ .Env.TRANSMISSION_ALT_SPEED_ENABLED }}, | ||
"alt-speed-time-begin": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_BEGIN }}, | ||
"alt-speed-time-day": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_DAY }}, | ||
"alt-speed-time-enabled": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_ENABLED }}, | ||
"alt-speed-time-end": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_END }}, | ||
"alt-speed-up": {{ .Env.TRANSMISSION_ALT_SPEED_UP }}, | ||
"bind-address-ipv4": "{{ .Env.TRANSMISSION_BIND_ADDRESS_IPV4 }}", | ||
"bind-address-ipv6": "{{ .Env.TRANSMISSION_BIND_ADDRESS_IPV6 }}", | ||
"blocklist-enabled": {{ .Env.TRANSMISSION_BLOCKLIST_ENABLED }}, | ||
"blocklist-url": "{{ .Env.TRANSMISSION_BLOCKLIST_URL }}", | ||
"cache-size-mb": {{ .Env.TRANSMISSION_CACHE_SIZE_MB }}, | ||
"dht-enabled": {{ .Env.TRANSMISSION_DHT_ENABLED }}, | ||
"download-dir": "{{ .Env.TRANSMISSION_DOWNLOAD_DIR }}", | ||
"download-limit": {{ .Env.TRANSMISSION_DOWNLOAD_LIMIT }}, | ||
"download-limit-enabled": {{ .Env.TRANSMISSION_DOWNLOAD_LIMIT_ENABLED }}, | ||
"download-queue-enabled": {{ .Env.TRANSMISSION_DOWNLOAD_QUEUE_ENABLED }}, | ||
"download-queue-size": {{ .Env.TRANSMISSION_DOWNLOAD_QUEUE_SIZE }}, | ||
"encryption": {{ .Env.TRANSMISSION_ENCRYPTION }}, | ||
"idle-seeding-limit": {{ .Env.TRANSMISSION_IDLE_SEEDING_LIMIT }}, | ||
"idle-seeding-limit-enabled": {{ .Env.TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED }}, | ||
"incomplete-dir": "{{ .Env.TRANSMISSION_INCOMPLETE_DIR }}", | ||
"incomplete-dir-enabled": {{ .Env.TRANSMISSION_INCOMPLETE_DIR_ENABLED }}, | ||
"lpd-enabled": {{ .Env.TRANSMISSION_LPD_ENABLED }}, | ||
"max-peers-global": {{ .Env.TRANSMISSION_MAX_PEERS_GLOBAL }}, | ||
"message-level": {{ .Env.TRANSMISSION_MESSAGE_LEVEL }}, | ||
"peer-congestion-algorithm": "{{ .Env.TRANSMISSION_PEER_CONGESTION_ALGORITHM }}", | ||
"peer-id-ttl-hours": {{ .Env.TRANSMISSION_PEER_ID_TTL_HOURS }}, | ||
"peer-limit-global": {{ .Env.TRANSMISSION_PEER_LIMIT_GLOBAL }}, | ||
"peer-limit-per-torrent": {{ .Env.TRANSMISSION_PEER_LIMIT_PER_TORRENT }}, | ||
"peer-port": {{ .Env.TRANSMISSION_PEER_PORT }}, | ||
"peer-port-random-high": {{ .Env.TRANSMISSION_PEER_PORT_RANDOM_HIGH }}, | ||
"peer-port-random-low": {{ .Env.TRANSMISSION_PEER_PORT_RANDOM_LOW }}, | ||
"peer-port-random-on-start": {{ .Env.TRANSMISSION_PEER_PORT_RANDOM_ON_START }}, | ||
"peer-socket-tos": "{{ .Env.TRANSMISSION_PEER_SOCKET_TOS }}", | ||
"pex-enabled": {{ .Env.TRANSMISSION_PEX_ENABLED }}, | ||
"port-forwarding-enabled": {{ .Env.TRANSMISSION_PORT_FORWARDING_ENABLED }}, | ||
"preallocation": {{ .Env.TRANSMISSION_PREALLOCATION }}, | ||
"prefetch-enabled": {{ .Env.TRANSMISSION_PREFETCH_ENABLED }}, | ||
"queue-stalled-enabled": {{ .Env.TRANSMISSION_QUEUE_STALLED_ENABLED }}, | ||
"queue-stalled-minutes": {{ .Env.TRANSMISSION_QUEUE_STALLED_MINUTES }}, | ||
"ratio-limit": {{ .Env.TRANSMISSION_RATIO_LIMIT }}, | ||
"ratio-limit-enabled": {{ .Env.TRANSMISSION_RATIO_LIMIT_ENABLED }}, | ||
"rename-partial-files": {{ .Env.TRANSMISSION_RENAME_PARTIAL_FILES }}, | ||
"rpc-authentication-required": {{ .Env.TRANSMISSION_RPC_AUTHENTICATION_REQUIRED }}, | ||
"rpc-bind-address": "{{ .Env.TRANSMISSION_RPC_BIND_ADDRESS }}", | ||
"rpc-enabled": {{ .Env.TRANSMISSION_RPC_ENABLED }}, | ||
"rpc-password": "{{ .Env.TRANSMISSION_RPC_PASSWORD }}", | ||
"rpc-port": {{ .Env.TRANSMISSION_RPC_PORT }}, | ||
"rpc-url": "{{ .Env.TRANSMISSION_RPC_URL }}", | ||
"rpc-username": "{{ .Env.TRANSMISSION_RPC_USERNAME }}", | ||
"rpc-whitelist": "{{ .Env.TRANSMISSION_RPC_WHITELIST }}", | ||
"rpc-whitelist-enabled": {{ .Env.TRANSMISSION_RPC_WHITELIST_ENABLED }}, | ||
"scrape-paused-torrents-enabled": {{ .Env.TRANSMISSION_SCRAPE_PAUSED_TORRENTS_ENABLED }}, | ||
"script-torrent-done-enabled": {{ .Env.TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED }}, | ||
"script-torrent-done-filename": "{{ .Env.TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME }}", | ||
"seed-queue-enabled": {{ .Env.TRANSMISSION_SEED_QUEUE_ENABLED }}, | ||
"seed-queue-size": {{ .Env.TRANSMISSION_SEED_QUEUE_SIZE }}, | ||
"speed-limit-down": {{ .Env.TRANSMISSION_SPEED_LIMIT_DOWN }}, | ||
"speed-limit-down-enabled": {{ .Env.TRANSMISSION_SPEED_LIMIT_DOWN_ENABLED }}, | ||
"speed-limit-up": {{ .Env.TRANSMISSION_SPEED_LIMIT_UP }}, | ||
"speed-limit-up-enabled": {{ .Env.TRANSMISSION_SPEED_LIMIT_UP_ENABLED }}, | ||
"start-added-torrents": {{ .Env.TRANSMISSION_START_ADDED_TORRENTS }}, | ||
"trash-original-torrent-files": {{ .Env.TRANSMISSION_TRASH_ORIGINAL_TORRENT_FILES }}, | ||
"umask": {{ .Env.TRANSMISSION_UMASK }}, | ||
"upload-limit": {{ .Env.TRANSMISSION_UPLOAD_LIMIT }}, | ||
"upload-limit-enabled": {{ .Env.TRANSMISSION_UPLOAD_LIMIT_ENABLED }}, | ||
"upload-slots-per-torrent": {{ .Env.TRANSMISSION_UPLOAD_SLOTS_PER_TORRENT }}, | ||
"utp-enabled": {{ .Env.TRANSMISSION_UTP_ENABLED }}, | ||
"watch-dir": "{{ .Env.TRANSMISSION_WATCH_DIR }}", | ||
"watch-dir-enabled": {{ .Env.TRANSMISSION_WATCH_DIR_ENABLED }} | ||
} | ||
|
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.
I also set these to a default bogus value. You can remove these as well if you'd like.