Skip to content

Commit

Permalink
rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed Aug 16, 2022
1 parent 7200eca commit d332716
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog][keepachangelog] and this project adher

### Added

- Possibility of changing DNS resolvers using environment variables `NAME_SERVER_1` (primary) and `NAME_SERVER_2` (secondary)
- Possibility of changing DNS resolvers using environment variables `PRIMARY_RESOLVER` (primary) and `SECONDARY_RESOLVER` (secondary)

## v1.5.0

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ All supported image tags [can be found here][link_docker_tags].

## Supported environment variables

| Variable name | Description | Example |
|------------------|-------------------------------------|------------------------|
| `PROXY_LOGIN` | Authorization login | `username` |
| `PROXY_PASSWORD` | Authorization password | `password` |
| `NAME_SERVER_1` | Primary nameserver (dns resolver) | `8.8.8.8` |
| `NAME_SERVER_2` | Secondary nameserver (dns resolver) | `2001:4860:4860::8844` |
| Variable name | Description | Example |
|----------------------|-------------------------------------|------------------------|
| `PROXY_LOGIN` | Authorization login | `username` |
| `PROXY_PASSWORD` | Authorization password | `password` |
| `PRIMARY_RESOLVER` | Primary nameserver (dns resolver) | `8.8.8.8` |
| `SECONDARY_RESOLVER` | Secondary nameserver (dns resolver) | `2001:4860:4860::8844` |

## How can I use this?

Expand All @@ -57,7 +57,7 @@ $ docker run --rm -d \
-p "1080:1080/tcp" \
-e "PROXY_LOGIN=evil" \
-e "PROXY_PASSWORD=live" \
-e "NAME_SERVER_1=2001:4860:4860::8888" \
-e "PRIMARY_RESOLVER=2001:4860:4860::8888" \
tarampampam/3proxy:latest
```

Expand Down
16 changes: 8 additions & 8 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ set -e

PROXY_LOGIN=${PROXY_LOGIN:-} # string
PROXY_PASSWORD=${PROXY_PASSWORD:-} # string
NAME_SERVER_1=${NAME_SERVER_1:-} # string
NAME_SERVER_2=${NAME_SERVER_2:-} # string
PRIMARY_RESOLVER=${PRIMARY_RESOLVER:-} # string
SECONDARY_RESOLVER=${SECONDARY_RESOLVER:-} # string

if [ -n "$PROXY_LOGIN" ] && [ -n "$PROXY_PASSWORD" ]; then
echo "$0: setup '${PROXY_LOGIN}:${PROXY_PASSWORD}' as proxy user";
sed -i "s~#AUTH_SETTINGS~users ${PROXY_LOGIN}:CL:${PROXY_PASSWORD}\nauth strong\nallow ${PROXY_LOGIN}~" /etc/3proxy/3proxy.cfg
fi;

if [ -n "$NAME_SERVER_1" ]; then
echo "$0: setup '${NAME_SERVER_1}' as the first nameserver";
sed -i "s~#NSERVER1~nserver ${NAME_SERVER_1}~" /etc/3proxy/3proxy.cfg
if [ -n "$PRIMARY_RESOLVER" ]; then
echo "$0: setup '${PRIMARY_RESOLVER}' as the first nameserver";
sed -i "s~#NSERVER1~nserver ${PRIMARY_RESOLVER}~" /etc/3proxy/3proxy.cfg
fi;

if [ -n "$NAME_SERVER_2" ]; then
echo "$0: setup '${NAME_SERVER_2}' as the second nameserver";
sed -i "s~#NSERVER2~nserver ${NAME_SERVER_2}~" /etc/3proxy/3proxy.cfg
if [ -n "$SECONDARY_RESOLVER" ]; then
echo "$0: setup '${SECONDARY_RESOLVER}' as the second nameserver";
sed -i "s~#NSERVER2~nserver ${SECONDARY_RESOLVER}~" /etc/3proxy/3proxy.cfg
fi;

exec "$@"

0 comments on commit d332716

Please sign in to comment.