Skip to content

Commit

Permalink
Merge branch 'master' into wk-pls
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr authored Nov 18, 2024
2 parents 57dea38 + 670e3e2 commit ac906a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func init() {
Flags for domain record create cmd
*/
domainRecordCreateCmd.Flags().StringVarP(&recordName, "name", "n", "", "the name of the record")
domainRecordCreateCmd.Flags().StringVarP(&recordType, "type", "e", "", "type of the record (A, CNAME, TXT, SRV, MX)")
domainRecordCreateCmd.Flags().StringVarP(&recordType, "type", "e", "", "type of the record (A, CNAME, TXT, SRV, MX, NS)")
domainRecordCreateCmd.Flags().StringVarP(&recordValue, "value", "v", "", "the value of the record")
domainRecordCreateCmd.Flags().IntVarP(&recordTTL, "ttl", "t", 600, "The TTL of the record")
domainRecordCreateCmd.Flags().IntVarP(&recordPriority, "priority", "p", 0, "the priority of record only for SRV and MX record")
Expand Down
14 changes: 9 additions & 5 deletions cmd/domain/domain_record_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,30 @@ var domainRecordCreateCmd = &cobra.Command{
// Sanitace the record type
recordType = strings.ReplaceAll(recordType, " ", "")

if recordType == "A" || recordType == "alias" {
if recordType == "A" || recordType == "a" || recordType == "alias" {
newRecordConfig.Type = civogo.DNSRecordTypeA
}

if recordType == "CNAME" || recordType == "canonical" {
if recordType == "CNAME" || recordType == "cname" || recordType == "canonical" {
newRecordConfig.Type = civogo.DNSRecordTypeCName
}

if recordType == "MX" || recordType == "mail" {
if recordType == "MX" || recordType == "mx" || recordType == "mail" {
newRecordConfig.Type = civogo.DNSRecordTypeMX
}

if recordType == "TXT" || recordType == "text" {
if recordType == "TXT" || recordType == "txt" || recordType == "text" {
newRecordConfig.Type = civogo.DNSRecordTypeTXT
}

if recordType == "SRV" || recordType == "service" {
if recordType == "SRV" || recordType == "srv" || recordType == "service" {
newRecordConfig.Type = civogo.DNSRecordTypeSRV
}

if recordType == "NS" || recordType == "ns" || recordType == "nameserver" {
newRecordConfig.Type = civogo.DNSRecordTypeNS
}

record, err := client.CreateDNSRecord(domain.ID, newRecordConfig)
if err != nil {
utility.Error("%s", err)
Expand Down

0 comments on commit ac906a6

Please sign in to comment.