HarshKapadia2 / HarshKapadia2/dynamic-dns

Improvements to current pub IP logic

Open
#1 4 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Shell
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Following are the improvements you could consider for updating the [DDNS script](https://github.com/HarshKapadia2/dynamic-dns/blob/main/ddns).

1. Handling no current file present
https://github.com/HarshKapadia2/dynamic-dns/blob/main/ddns#L19-L21
**Resolution**: There is no point in proceeding further if the file public-ip-in-use if absent. The if condition should have an `exit 1` statement.

2. Logic in updating public-ip-in-use
As soon as the program sees the IP as changed it tries to update the local state first without considering whether the remote state has been updated.
https://github.com/HarshKapadia2/dynamic-dns/blob/main/ddns#L25
**Resolution**: Move the update IP to text file line inside the if condition `"${cloudflare_http_res_code}" == "200"`
This handles the scenario when Cloudflare is down, API key errors, the internet not working, etc .. and your IP on local text file is already updated on next run.

3. Doc/automation improvements for configurations
- How about storing all env variables like token,zone id, etc in a `.local_ddns` file in `/home/` dir. when the script starts it'll load up using commands like `source` .
- Create a script (install.sh) that can directly add required cron, populate env file (run-ddns, list-all-dns-records) , everything at one go, making setup process hassle free.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the ddns script sections linked around lines 19–21 and 25, then trace the Cloudflare response-code check. Done means missing state causes the script to exit, local IP state updates only after a successful remote update, and the proposed configuration or install automation is implemented if included in scope; no test files are named.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cloud, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.