Skip to content

Commit

Permalink
fix: use non-deprecated -profile instead of -config
Browse files Browse the repository at this point in the history
  • Loading branch information
JeDaYoshi committed Apr 6, 2023
1 parent e8dd82f commit 580b2d4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
- name: Publish GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXTDNS_TAG: ${{ needs.fetch.outputs.nextdns_tag }}
NEXTDNS_VER: ${{ needs.fetch.outputs.nextdns_ver }}
RELEASE_NEW: ${{ needs.fetch.outputs.release_new }}
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ Tags will be automatically published under matching versions as upstream release
## Usage

You can pass what you would use with arguments as environment variables to the container.
Make sure to prefix all variables with `NEXTDNS_`, where `NEXTDNS_CONFIG=xxxxxx` would become `-config=xxxxxx` to the CLI.
Make sure to prefix all variables with `NEXTDNS_`, where `NEXTDNS_PROFILE=xxxxxx` would become `-profile=xxxxxx` to the CLI.

In addition, in order to support
[Conditional Configuration](https://github.com/nextdns/nextdns/wiki/Conditional-Configuration) and
[Conditional Profiles](https://github.com/nextdns/nextdns/wiki/Conditional-Profile) and
[Split Horizon/Conditional Forwarders](https://github.com/nextdns/nextdns/wiki/Split-Horizon),
you can also use `NEXTDNS_CONFIG_$NAME` or `NEXTDNS_FORWARDER_$NAME` to pass additional settings
you can also use `NEXTDNS_PROFILE_$NAME` or `NEXTDNS_FORWARDER_$NAME` to pass additional settings
(where `$NAME` is a personal identifier, and is not passed to the CLI.)

To start it, it's how you would usually do it:

```sh
docker pull jedayoshi/nextdns:latest
docker run -d --name nextdns --restart always -p "53:53/tcp" -p "53:53/udp" --env "NEXTDNS_CONFIG=xxxxxx" --env "NEXTDNS_CACHE_SIZE=10m" --env "NEXTDNS_REPORT_CLIENT_INFO=true" jedayoshi/nextdns:latest"
docker run -d --name nextdns --restart always -p "53:53/tcp" -p "53:53/udp" --env "NEXTDNS_PROFILE=xxxxxx" --env "NEXTDNS_CACHE_SIZE=10m" --env "NEXTDNS_REPORT_CLIENT_INFO=true" jedayoshi/nextdns:latest"
```
Or, use `docker-compose`! Here's an example:
Expand All @@ -37,7 +37,7 @@ services:
- "53:53/tcp"
- "53:53/udp"
environment:
NEXTDNS_CONFIG: "xxxxxx"
NEXTDNS_PROFILE: "xxxxxx"
NEXTDNS_CACHE_SIZE: "10m"
NEXTDNS_REPORT_CLIENT_INFO: "true"
# Warning: This WILL use your DNS query quota. Since its TTL is 300s,
Expand Down Expand Up @@ -72,9 +72,9 @@ services:
- "53:53/tcp"
- "53:53/udp"
environment:
NEXTDNS_CONFIG: "xxxxxx"
NEXTDNS_CONFIG_HOME: "192.168.0.0/24=aaaaaa"
NEXTDNS_CONFIG_OFFICE: "10.18.0.0/16=wwwwww"
NEXTDNS_PROFILE: "xxxxxx"
NEXTDNS_PROFILE_HOME: "192.168.0.0/24=aaaaaa"
NEXTDNS_PROFILE_OFFICE: "10.18.0.0/16=wwwwww"
NEXTDNS_CACHE_SIZE: "10m"
NEXTDNS_REPORT_CLIENT_INFO: "true"
NEXTDNS_USE_HOSTS: "true"
Expand Down
14 changes: 10 additions & 4 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ export NEXTDNS_USE_HOSTS="${NEXTDNS_USE_HOSTS:-false}"
CLI_ARGS="-setup-router=true"

while IFS="=" read -r var val; do
if [[ "$var" = "NEXTDNS_CONFIG_"* ]]; then
CLI_ARGS="$CLI_ARGS -config=$val"
if [[ "$var" = "NEXTDNS_PROFILE_"* ]]; then
CLI_ARGS="$CLI_ARGS -profile=$val"
elif [[ "$var" = "NEXTDNS_FORWARDER_"* ]]; then
CLI_ARGS="$CLI_ARGS -forwarder=$val"
elif [[ "$var" = "NEXTDNS_CONFIG" ]]; then
echo "! NEXTDNS_CONFIG is deprecated. Please use NEXTDNS_PROFILE from now on"
CLI_ARGS="$CLI_ARGS -profile=$val"
elif [[ "$var" = "NEXTDNS_CONFIG_"* ]]; then
echo "! NEXTDNS_CONFIG_<value> is deprecated. Please use NEXTDNS_PROFILE_<value> from now on"
CLI_ARGS="$CLI_ARGS -profile=$val"
else
var=$(echo "$var" | cut -d "_" -f2- | tr "[:upper:]" "[:lower:]" | tr "_" "-")
CLI_ARGS="$CLI_ARGS -$var=$val"
var=$(echo "$var" | cut -d "_" -f2- | tr "[:upper:]" "[:lower:]" | tr "_" "-")
CLI_ARGS="$CLI_ARGS -$var=$val"
fi
done < <(env | grep "NEXTDNS_")

Expand Down

0 comments on commit 580b2d4

Please sign in to comment.