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

implement civo domain records update #386

Open
kallisti5 opened this issue Apr 25, 2024 · 0 comments
Open

implement civo domain records update #386

kallisti5 opened this issue Apr 25, 2024 · 0 comments

Comments

@kallisti5
Copy link

kallisti5 commented Apr 25, 2024

Instead of requiring users to "remove and recreate" domain records, it would be nice to implement an "update" action.

Proposed usage:

civo domain record update domain.com -n thing.domain.com -v "0.0.0.0"

Currently you have to pragmatically find the record id to remove the existing record, then recreate it which is... not great...

#!/bin/bash

export DOMAIN="domain.com"
export TARGET="subdomain"

export EV4="$(curl -q -4 ifconfig.me 2>/dev/null)"
export EV6="$(curl -q -6 ifconfig.me 2>/dev/null)"

echo "My external IP is $EV4 / $EV6"

EV4ID=$(civo domain record ls $DOMAIN -o json | jq -r ".[] | select(.name==\"$TARGET\") | .id")
EV4IP=$(civo domain record ls $DOMAIN -o json | jq -r ".[] | select(.name==\"$TARGET\") | .value")

if [[ $EV4IP == $EV4 ]]; then
    echo "No updates needed"
else
    civo domain record remove $DOMAIN $EV4ID -y
    civo domain record create $DOMAIN -n ${TARGET}.${DOMAIN} -e A -v $EV4
fi
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

1 participant