DEVELOPMENT ENVIRONMENT

~liljamo/felu

230d0a96b7eccd5e586dadb29ce160e7089b57c6 — Jonni Liljamo 26 days ago a3ddc93
fix: set tsigKey when creating a domain
1 files changed, 3 insertions(+), 2 deletions(-)

M internal/db/domains.go
M internal/db/domains.go => internal/db/domains.go +3 -2
@@ 95,8 95,9 @@ func FetchAllDomains() ([]Domain, error) {
func CreateDomain(domain string, aRecord string, owner string) error {
	ulid := ulid.Make().String()
	apikey := util.GenAPIKey()
	_, err := DBConn.Exec(`INSERT INTO domains(id, apikey, ddns_domain, a_record, owner)
		VALUES ($1, $2, $3, $4, $5)`, ulid, apikey, domain, aRecord, owner)
	tsigKey := util.GenTsigKey()
	_, err := DBConn.Exec(`INSERT INTO domains(id, apikey, ddns_domain, a_record, tsigkey, owner)
		VALUES ($1, $2, $3, $4, $5, $6)`, ulid, apikey, domain, aRecord, tsigKey, owner)
	if err != nil {
		return err
	}