Skip to content
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

Use of env or config #5

Open
Cyb3r-Jak3 opened this issue Jun 4, 2022 · 1 comment
Open

Use of env or config #5

Cyb3r-Jak3 opened this issue Jun 4, 2022 · 1 comment
Assignees

Comments

@Cyb3r-Jak3
Copy link
Owner

To simplify configuration, we should accept either a config file, probably YAML, or an .env file.

@Cyb3r-Jak3 Cyb3r-Jak3 self-assigned this Jun 4, 2022
@StudioLE
Copy link

Both .env and .yml configuration are easily accomplished by using docker compose. It also cuts out the complexity of installing go etc.

Here's an approximation of the workflow I'm using:

  1. docker-compose.yml
version: "3"

services:
  version:
    image: cyb3rjak3/cloudflare-utils
    command: --version
    
  help:
    image: cyb3rjak3/cloudflare-utils
    command: --help
  
  download:
    image: cyb3rjak3/cloudflare-utils
    environment:
      CLOUDFLARE_API_TOKEN: ${CLOUDFLARE_API_TOKEN}
      CLOUDFLARE_ZONE_NAME: ${CLOUDFLARE_ZONE_NAME}
      LOG_LEVEL_VERBOSE: ${LOG_LEVEL_VERBOSE}
      LOG_LEVEL_DEBUG: ${LOG_LEVEL_DEBUG}
    command: dns-cleaner download
    volumes:
    - ./records/${CLOUDFLARE_ZONE_NAME}.yml:/dns-records.yml

  upload:
    image: cyb3rjak3/cloudflare-utils
    environment:
      CLOUDFLARE_API_TOKEN: ${CLOUDFLARE_API_TOKEN}
      CLOUDFLARE_ZONE_NAME: ${CLOUDFLARE_ZONE_NAME}
      LOG_LEVEL_VERBOSE: ${LOG_LEVEL_VERBOSE}
      LOG_LEVEL_DEBUG: ${LOG_LEVEL_DEBUG}
    command: dns-cleaner upload
    volumes:
    - ./records/${CLOUDFLARE_ZONE_NAME}.yml:/dns-records.yml
  1. .env
CLOUDFLARE_API_TOKEN=
CLOUDFLARE_ZONE_NAME=
LOG_LEVEL_VERBOSE=true
LOG_LEVEL_DEBUG=true
  1. Create an empty file for dns records
touch records/[YOUR_CLOUDFLARE_ZONE_NAME].yml
  1. Run dns-cleaner download
docker compose run download
  1. Edit the dns records file.
nano records/[YOUR_CLOUDFLARE_ZONE_NAME].yml
  1. Run dns-cleaner upload
docker compose run upload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants