Skip to content

Commit

Permalink
Merge pull request #92 from rezytijo/main
Browse files Browse the repository at this point in the history
 Add DNS Record Types
  • Loading branch information
tiredofit authored Nov 22, 2023
2 parents 707211b + 27e13e1 commit c6676a2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build to pricate account.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
create-image-push:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
tags: rezytijo/docker-traefik-cloudflare-companion:latest
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ Be sure to view the following repositories to understand all the customizable op
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `CF_EMAIL` | Email address tied to Cloudflare Account - Leave Blank for Scoped API | |
| `CF_TOKEN` | API Token for the Domain | |
| `TARGET_DOMAIN` | Destination Host to forward records to e.g. `host.example.com` | |
| `RC_TYPE` | Record Type for The Cloudflare e.g. `A;CNAME;AAAA` | CNAME |
| `TARGET_DOMAIN` | Destination Hostname/IP to forward records to e.g. `host.example.com or 172.30.0.1` | |
| `DOMAIN1` | Domain 1 you wish to update records for. | |
| `DOMAIN1_ZONE_ID` | Domain 1 Zone ID from Cloudflare | |
| `DOMAIN1_PROXIED` | Domain 1 True or False if proxied | |
Expand All @@ -172,8 +173,8 @@ Be sure to view the following repositories to understand all the customizable op
| `ENABLE_TRAEFIK_POLL` | Enable Traefik Polling Mode `TRUE` or `FALSE` | `FALSE` |
| `TRAEFIK_POLL_URL` | (optional) If using Traefik Polling mode - URL to Traefik API endpoint | |
| `TRAEFIK_POLL_SECONDS` | (optional) If using Traefik Polling mode - Seconds to delay between poll attemps | `60` |
| `TRAEFIK_FILTER_LABEL` | (optional) Filter by this label | `traefik.constraint` |
| `TRAEFIK_FILTER` | (optional) Filter by above Label and Value | |
| `TRAEFIK_FILTER_LABEL` | (optional) Filter by this label | `traefik.constraint` |
| `TRAEFIK_FILTER` | (optional) Filter by above Label and Value | |
| `TRAEFIK_INCLUDED_HOST1` | (optional) If using Traefik Polling mode - Regex patterns for hosts to include | `.*` |
| `TRAEFIK_INCLUDED_HOST...` | (optional traefik host include pattern 2 - N) | |
| `TRAEFIK_EXCLUDED_HOST1` | (optional) If using Traefik Polling mode - Regex patterns for hosts to exclude | |
Expand Down
1 change: 1 addition & 0 deletions examples/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
- TRAEFIK_VERSION=2
- [email protected]
- CF_TOKEN=fbSx3dk3A3mJ6UukLQ7zRbo63H5UdsGSCqQnTvbJDgyQaTp
- RC_TYPE=CNAME

- TARGET_DOMAIN=host.example.org
- DOMAIN1=example.org
Expand Down
6 changes: 3 additions & 3 deletions install/usr/sbin/cloudflare-companion
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ TRAEFIK_FILTER_LABEL = os.environ.get('TRAEFIK_FILTER_LABEL', "traefik.constrain
TRAEFIK_POLL_SECONDS = int(os.environ.get('TRAEFIK_POLL_SECONDS', "60"))
TRAEFIK_POLL_URL = os.environ.get('TRAEFIK_POLL_URL', None)
TRAEFIK_VERSION = os.environ.get('TRAEFIK_VERSION', "2")
RC_TYPE = os.environ.get('RC_TYPE', "CNAME")


# Handle Ctrl C
Expand Down Expand Up @@ -161,7 +162,7 @@ def is_matching(host, regexes):
return True
return False


# Start Program to update the Cloudflare
def point_domain(name, domain_infos):
ok = True
for domain_info in domain_infos:
Expand All @@ -174,7 +175,7 @@ def point_domain(name, domain_infos):

records = cf.zones.dns_records.get(domain_info['zone_id'], params={u'name': name})
data = {
u'type': u'CNAME',
u'type': RC_TYPE,
u'name': name,
u'content': domain_info['target_domain'],
u'ttl': domain_info['ttl'],
Expand Down Expand Up @@ -211,7 +212,6 @@ def point_domain(name, domain_infos):
ok = False
return ok


def check_container_t1(c):
def label_host():
for prop in c.attrs.get(u'Config').get(u'Labels'):
Expand Down

0 comments on commit c6676a2

Please sign in to comment.