Skip to content

Commit c6676a2

Browse files
authored
Merge pull request #92 from rezytijo/main
Add DNS Record Types
2 parents 707211b + 27e13e1 commit c6676a2

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
create-image-push:
11+
runs-on: ubuntu-latest
12+
steps:
13+
-
14+
name: Set up QEMU
15+
uses: docker/setup-qemu-action@v3
16+
-
17+
name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
-
20+
name: Login to Docker Hub
21+
uses: docker/login-action@v3
22+
with:
23+
username: ${{ secrets.DOCKERHUB_USERNAME }}
24+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
25+
-
26+
name: Build and push
27+
uses: docker/build-push-action@v5
28+
with:
29+
push: true
30+
platforms: linux/amd64,linux/arm64
31+
tags: rezytijo/docker-traefik-cloudflare-companion:latest

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ Be sure to view the following repositories to understand all the customizable op
150150
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
151151
| `CF_EMAIL` | Email address tied to Cloudflare Account - Leave Blank for Scoped API | |
152152
| `CF_TOKEN` | API Token for the Domain | |
153-
| `TARGET_DOMAIN` | Destination Host to forward records to e.g. `host.example.com` | |
153+
| `RC_TYPE` | Record Type for The Cloudflare e.g. `A;CNAME;AAAA` | CNAME |
154+
| `TARGET_DOMAIN` | Destination Hostname/IP to forward records to e.g. `host.example.com or 172.30.0.1` | |
154155
| `DOMAIN1` | Domain 1 you wish to update records for. | |
155156
| `DOMAIN1_ZONE_ID` | Domain 1 Zone ID from Cloudflare | |
156157
| `DOMAIN1_PROXIED` | Domain 1 True or False if proxied | |
@@ -172,8 +173,8 @@ Be sure to view the following repositories to understand all the customizable op
172173
| `ENABLE_TRAEFIK_POLL` | Enable Traefik Polling Mode `TRUE` or `FALSE` | `FALSE` |
173174
| `TRAEFIK_POLL_URL` | (optional) If using Traefik Polling mode - URL to Traefik API endpoint | |
174175
| `TRAEFIK_POLL_SECONDS` | (optional) If using Traefik Polling mode - Seconds to delay between poll attemps | `60` |
175-
| `TRAEFIK_FILTER_LABEL` | (optional) Filter by this label | `traefik.constraint` |
176-
| `TRAEFIK_FILTER` | (optional) Filter by above Label and Value | |
176+
| `TRAEFIK_FILTER_LABEL` | (optional) Filter by this label | `traefik.constraint` |
177+
| `TRAEFIK_FILTER` | (optional) Filter by above Label and Value | |
177178
| `TRAEFIK_INCLUDED_HOST1` | (optional) If using Traefik Polling mode - Regex patterns for hosts to include | `.*` |
178179
| `TRAEFIK_INCLUDED_HOST...` | (optional traefik host include pattern 2 - N) | |
179180
| `TRAEFIK_EXCLUDED_HOST1` | (optional) If using Traefik Polling mode - Regex patterns for hosts to exclude | |

examples/compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ services:
1414
- TRAEFIK_VERSION=2
1515
- CF_EMAIL=email@example.com
1616
- CF_TOKEN=fbSx3dk3A3mJ6UukLQ7zRbo63H5UdsGSCqQnTvbJDgyQaTp
17+
- RC_TYPE=CNAME
1718

1819
- TARGET_DOMAIN=host.example.org
1920
- DOMAIN1=example.org

install/usr/sbin/cloudflare-companion

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ TRAEFIK_FILTER_LABEL = os.environ.get('TRAEFIK_FILTER_LABEL', "traefik.constrain
3434
TRAEFIK_POLL_SECONDS = int(os.environ.get('TRAEFIK_POLL_SECONDS', "60"))
3535
TRAEFIK_POLL_URL = os.environ.get('TRAEFIK_POLL_URL', None)
3636
TRAEFIK_VERSION = os.environ.get('TRAEFIK_VERSION', "2")
37+
RC_TYPE = os.environ.get('RC_TYPE', "CNAME")
3738

3839

3940
# Handle Ctrl C
@@ -161,7 +162,7 @@ def is_matching(host, regexes):
161162
return True
162163
return False
163164

164-
165+
# Start Program to update the Cloudflare
165166
def point_domain(name, domain_infos):
166167
ok = True
167168
for domain_info in domain_infos:
@@ -174,7 +175,7 @@ def point_domain(name, domain_infos):
174175

175176
records = cf.zones.dns_records.get(domain_info['zone_id'], params={u'name': name})
176177
data = {
177-
u'type': u'CNAME',
178+
u'type': RC_TYPE,
178179
u'name': name,
179180
u'content': domain_info['target_domain'],
180181
u'ttl': domain_info['ttl'],
@@ -211,7 +212,6 @@ def point_domain(name, domain_infos):
211212
ok = False
212213
return ok
213214

214-
215215
def check_container_t1(c):
216216
def label_host():
217217
for prop in c.attrs.get(u'Config').get(u'Labels'):

0 commit comments

Comments
 (0)