mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
bump: github.com/akamai/AkamaiOPEN-edgegrid-golang to v11 (#2524)
This commit is contained in:
parent
8521cbc977
commit
0ec467f075
5 changed files with 215 additions and 138 deletions
8
go.mod
8
go.mod
|
|
@ -15,7 +15,7 @@ require (
|
|||
github.com/Azure/go-autorest/autorest/to v0.4.1
|
||||
github.com/BurntSushi/toml v1.5.0
|
||||
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang/v11 v11.0.0
|
||||
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.8
|
||||
github.com/aliyun/credentials-go v1.4.6
|
||||
github.com/aws/aws-sdk-go-v2 v1.36.6
|
||||
|
|
@ -128,7 +128,7 @@ require (
|
|||
github.com/aws/aws-sdk-go-v2/service/sso v1.25.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.4 // indirect
|
||||
github.com/aws/smithy-go v1.22.4 // indirect
|
||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
||||
github.com/benbjohnson/clock v1.3.5 // indirect
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
|
||||
|
|
@ -142,6 +142,7 @@ require (
|
|||
github.com/go-errors/errors v1.0.1 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.23.0 // indirect
|
||||
|
|
@ -169,7 +170,6 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/peterhellberg/link v1.2.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
|
|
@ -187,7 +187,7 @@ require (
|
|||
github.com/sony/gobreaker v1.0.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.6.0 // indirect
|
||||
github.com/spf13/cast v1.7.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.18.2 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
|
|
|
|||
29
go.sum
29
go.sum
|
|
@ -105,8 +105,8 @@ github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/
|
|||
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
|
||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 h1:F1j7z+/DKEsYqZNoxC6wvfmaiDneLsQOFQmuq9NADSY=
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2/go.mod h1:QlXr/TrICfQ/ANa76sLeQyhAJyNR9sEcfNuZBkY9jgY=
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang/v11 v11.0.0 h1:ot8yMzEm0Kx2LCTOzlM7zh4ASLFZ6H0iYhtIKolSujs=
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang/v11 v11.0.0/go.mod h1:rvh3imDA6EaQi+oM/GQHkQAOHbXPKJ7EWJvfjuw141Q=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
|
|
@ -166,6 +166,9 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
|
|||
github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
|
||||
github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
|
||||
github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4=
|
||||
|
|
@ -216,8 +219,8 @@ github.com/aziontech/azionapi-go-sdk v0.142.0/go.mod h1:cA5DY/VP4X5Eu11LpQNzNn83
|
|||
github.com/baidubce/bce-sdk-go v0.9.235 h1:iAi+seH9w1Go2szFNzyGumahLGDsuYZ3i8hduX3qiM8=
|
||||
github.com/baidubce/bce-sdk-go v0.9.235/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
|
||||
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
|
||||
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
|
|
@ -340,6 +343,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
|||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es=
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
|
|
@ -447,7 +452,6 @@ github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73
|
|||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
|
||||
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
|
|
@ -476,8 +480,6 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmg
|
|||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
|
||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
|
|
@ -674,7 +676,6 @@ github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/
|
|||
github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s=
|
||||
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nrdcg/auroradns v1.1.0 h1:KekGh8kmf2MNwqZVVYo/fw/ZONt8QMEmbMFOeljteWo=
|
||||
github.com/nrdcg/auroradns v1.1.0/go.mod h1:O7tViUZbAcnykVnrGkXzIJTHoQCHcgalgAe6X1mzHfk=
|
||||
|
|
@ -733,8 +734,6 @@ github.com/ovh/go-ovh v1.9.0 h1:6K8VoL3BYjVV3In9tPJUdT7qMx9h0GExN9EXx1r2kKE=
|
|||
github.com/ovh/go-ovh v1.9.0/go.mod h1:cTVDnl94z4tl8pP1uZ/8jlVxntjSIf09bNcQ5TJSC7c=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
||||
|
|
@ -858,8 +857,8 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
|||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
|
||||
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
|
|
@ -921,9 +920,6 @@ github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+
|
|||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||
github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
|
||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
|
||||
|
|
@ -1460,10 +1456,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV
|
|||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
|
||||
gopkg.in/h2non/gock.v1 v1.0.15 h1:SzLqcIlb/fDfg7UvukMpNcWsu7sI5tWwL+KCATZqks0=
|
||||
gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
|
||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
|
|
|
|||
|
|
@ -2,14 +2,17 @@
|
|||
package edgedns
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
configdns "github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v2"
|
||||
"github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
|
||||
edgegriddns "github.com/akamai/AkamaiOPEN-edgegrid-golang/v11/pkg/dns"
|
||||
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v11/pkg/edgegrid"
|
||||
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v11/pkg/session"
|
||||
"github.com/go-acme/lego/v4/challenge"
|
||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||
"github.com/go-acme/lego/v4/log"
|
||||
|
|
@ -20,14 +23,8 @@ import (
|
|||
const (
|
||||
envNamespace = "AKAMAI_"
|
||||
|
||||
EnvEdgeRc = envNamespace + "EDGERC"
|
||||
EnvEdgeRcSection = envNamespace + "EDGERC_SECTION"
|
||||
|
||||
EnvHost = envNamespace + "HOST"
|
||||
EnvClientToken = envNamespace + "CLIENT_TOKEN"
|
||||
EnvClientSecret = envNamespace + "CLIENT_SECRET"
|
||||
EnvAccessToken = envNamespace + "ACCESS_TOKEN"
|
||||
|
||||
EnvEdgeRc = envNamespace + "EDGERC"
|
||||
EnvEdgeRcSection = envNamespace + "EDGERC_SECTION"
|
||||
EnvAccountSwitchKey = envNamespace + "ACCOUNT_SWITCH_KEY"
|
||||
|
||||
EnvTTL = envNamespace + "TTL"
|
||||
|
|
@ -35,6 +32,15 @@ const (
|
|||
EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
|
||||
)
|
||||
|
||||
// Test Environment variables names (unused).
|
||||
// TODO(ldez): must be moved into test files.
|
||||
const (
|
||||
EnvHost = envNamespace + "HOST"
|
||||
EnvClientToken = envNamespace + "CLIENT_TOKEN"
|
||||
EnvClientSecret = envNamespace + "CLIENT_SECRET"
|
||||
EnvAccessToken = envNamespace + "ACCESS_TOKEN"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultPropagationTimeout = 3 * time.Minute
|
||||
defaultPollInterval = 15 * time.Second
|
||||
|
|
@ -46,7 +52,7 @@ var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
|
|||
|
||||
// Config is used to configure the creation of the DNSProvider.
|
||||
type Config struct {
|
||||
edgegrid.Config
|
||||
*edgegrid.Config
|
||||
PropagationTimeout time.Duration
|
||||
PollingInterval time.Duration
|
||||
TTL int
|
||||
|
|
@ -58,7 +64,7 @@ func NewDefaultConfig() *Config {
|
|||
TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL),
|
||||
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, defaultPropagationTimeout),
|
||||
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, defaultPollInterval),
|
||||
Config: edgegrid.Config{MaxBody: maxBody},
|
||||
Config: &edgegrid.Config{MaxBody: maxBody},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,27 +79,27 @@ type DNSProvider struct {
|
|||
// 1. Section-specific environment variables `AKAMAI_{SECTION}_HOST`, `AKAMAI_{SECTION}_ACCESS_TOKEN`, `AKAMAI_{SECTION}_CLIENT_TOKEN`, `AKAMAI_{SECTION}_CLIENT_SECRET` where `{SECTION}` is specified using `AKAMAI_EDGERC_SECTION`
|
||||
// 2. If `AKAMAI_EDGERC_SECTION` is not defined or is set to `default`: Environment variables `AKAMAI_HOST`, `AKAMAI_ACCESS_TOKEN`, `AKAMAI_CLIENT_TOKEN`, `AKAMAI_CLIENT_SECRET`
|
||||
// 3. .edgerc file located at `AKAMAI_EDGERC` (defaults to `~/.edgerc`, sections can be specified using `AKAMAI_EDGERC_SECTION`)
|
||||
// 4. Default environment variables: `AKAMAI_HOST`, `AKAMAI_ACCESS_TOKEN`, `AKAMAI_CLIENT_TOKEN`, `AKAMAI_CLIENT_SECRET`
|
||||
//
|
||||
// See also: https://developer.akamai.com/api/getting-started
|
||||
func NewDNSProvider() (*DNSProvider, error) {
|
||||
config := NewDefaultConfig()
|
||||
|
||||
rcPath := env.GetOrDefaultString(EnvEdgeRc, "")
|
||||
rcSection := env.GetOrDefaultString(EnvEdgeRcSection, "")
|
||||
accountSwitchKey := env.GetOrDefaultString(EnvAccountSwitchKey, "")
|
||||
|
||||
conf, err := edgegrid.Init(rcPath, rcSection)
|
||||
conf, err := edgegrid.New(
|
||||
edgegrid.WithEnv(true),
|
||||
edgegrid.WithFile(env.GetOrDefaultString(EnvEdgeRc, "~/.edgerc")),
|
||||
edgegrid.WithSection(env.GetOrDefaultString(EnvEdgeRcSection, "default")),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
||||
conf.MaxBody = maxBody
|
||||
|
||||
accountSwitchKey := env.GetOrDefaultString(EnvAccountSwitchKey, "")
|
||||
|
||||
if accountSwitchKey != "" {
|
||||
conf.AccountKey = accountSwitchKey
|
||||
}
|
||||
|
||||
config := NewDefaultConfig()
|
||||
config.Config = conf
|
||||
|
||||
return NewDNSProviderConfig(config)
|
||||
|
|
@ -105,7 +111,10 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
return nil, errors.New("edgedns: the configuration of the DNS provider is nil")
|
||||
}
|
||||
|
||||
configdns.Init(config.Config)
|
||||
err := config.Validate()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
||||
return &DNSProvider{config: config}, nil
|
||||
}
|
||||
|
|
@ -118,14 +127,27 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
|
|||
|
||||
// Present creates a TXT record to fulfill the dns-01 challenge.
|
||||
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
ctx := context.Background()
|
||||
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
sess, err := session.New(session.WithSigner(d.config))
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
||||
client := edgegriddns.Client(sess)
|
||||
|
||||
zone, err := getZone(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
||||
record, err := configdns.GetRecord(zone, info.EffectiveFQDN, "TXT")
|
||||
record, err := client.GetRecord(ctx, edgegriddns.GetRecordRequest{
|
||||
Zone: zone,
|
||||
Name: info.EffectiveFQDN,
|
||||
RecordType: "TXT",
|
||||
})
|
||||
if err != nil && !isNotFound(err) {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
|
@ -145,7 +167,16 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
record.Target = append(record.Target, `"`+info.Value+`"`)
|
||||
record.TTL = d.config.TTL
|
||||
|
||||
err = record.Update(zone)
|
||||
err = client.UpdateRecord(ctx, edgegriddns.UpdateRecordRequest{
|
||||
Record: &edgegriddns.RecordBody{
|
||||
Name: record.Name,
|
||||
RecordType: record.RecordType,
|
||||
TTL: record.TTL,
|
||||
Active: record.Active,
|
||||
Target: record.Target,
|
||||
},
|
||||
Zone: zone,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
|
@ -153,14 +184,16 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
record = &configdns.RecordBody{
|
||||
Name: info.EffectiveFQDN,
|
||||
RecordType: "TXT",
|
||||
TTL: d.config.TTL,
|
||||
Target: []string{`"` + info.Value + `"`},
|
||||
}
|
||||
|
||||
err = record.Save(zone)
|
||||
err = client.CreateRecord(ctx, edgegriddns.CreateRecordRequest{
|
||||
Record: &edgegriddns.RecordBody{
|
||||
Name: info.EffectiveFQDN,
|
||||
RecordType: "TXT",
|
||||
TTL: d.config.TTL,
|
||||
Target: []string{`"` + info.Value + `"`},
|
||||
},
|
||||
Zone: zone,
|
||||
RecLock: nil,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
|
@ -170,14 +203,27 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
|
||||
// CleanUp removes the record matching the specified parameters.
|
||||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||
ctx := context.Background()
|
||||
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
sess, err := session.New(session.WithSigner(d.config))
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
||||
client := edgegriddns.Client(sess)
|
||||
|
||||
zone, err := getZone(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
||||
existingRec, err := configdns.GetRecord(zone, info.EffectiveFQDN, "TXT")
|
||||
existingRec, err := client.GetRecord(ctx, edgegriddns.GetRecordRequest{
|
||||
Zone: zone,
|
||||
Name: info.EffectiveFQDN,
|
||||
RecordType: "TXT",
|
||||
})
|
||||
if err != nil {
|
||||
if isNotFound(err) {
|
||||
return nil
|
||||
|
|
@ -197,19 +243,21 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var newRData []string
|
||||
for _, val := range existingRec.Target {
|
||||
val = strings.Trim(val, `"`)
|
||||
if val == info.Value {
|
||||
continue
|
||||
}
|
||||
newRData = append(newRData, val)
|
||||
}
|
||||
newRData := filterRData(existingRec, info)
|
||||
|
||||
if len(newRData) > 0 {
|
||||
existingRec.Target = newRData
|
||||
|
||||
err = existingRec.Update(zone)
|
||||
err = client.UpdateRecord(ctx, edgegriddns.UpdateRecordRequest{
|
||||
Record: &edgegriddns.RecordBody{
|
||||
Name: existingRec.Name,
|
||||
RecordType: existingRec.RecordType,
|
||||
TTL: existingRec.TTL,
|
||||
Active: existingRec.Active,
|
||||
Target: existingRec.Target,
|
||||
},
|
||||
Zone: zone,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
|
@ -217,7 +265,12 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
err = existingRec.Delete(zone)
|
||||
err = client.DeleteRecord(ctx, edgegriddns.DeleteRecordRequest{
|
||||
Zone: zone,
|
||||
Name: existingRec.Name,
|
||||
RecordType: "TXT",
|
||||
RecLock: nil,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("edgedns: %w", err)
|
||||
}
|
||||
|
|
@ -245,6 +298,19 @@ func isNotFound(err error) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
var e configdns.ConfigDNSError
|
||||
return errors.As(err, &e) && e.NotFound()
|
||||
var e *edgegriddns.Error
|
||||
return errors.As(err, &e) && e.StatusCode == http.StatusNotFound
|
||||
}
|
||||
|
||||
func filterRData(existingRec *edgegriddns.GetRecordResponse, info dns01.ChallengeInfo) []string {
|
||||
var newRData []string
|
||||
for _, val := range existingRec.Target {
|
||||
val = strings.Trim(val, `"`)
|
||||
if val == info.Value {
|
||||
continue
|
||||
}
|
||||
newRData = append(newRData, val)
|
||||
}
|
||||
|
||||
return newRData
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package edgedns
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
configdns "github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v2"
|
||||
edgegriddns "github.com/akamai/AkamaiOPEN-edgegrid-golang/v11/pkg/dns"
|
||||
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v11/pkg/session"
|
||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
@ -69,10 +71,21 @@ func TestLiveTTL(t *testing.T) {
|
|||
zone, err := getZone(fqdn)
|
||||
require.NoError(t, err)
|
||||
|
||||
resourceRecordSets, err := configdns.GetRecordList(zone, fqdn, "TXT")
|
||||
ctx := context.Background()
|
||||
|
||||
sess, err := session.New(session.WithSigner(provider.config))
|
||||
require.NoError(t, err)
|
||||
|
||||
for i, rrset := range resourceRecordSets.Recordsets {
|
||||
client := edgegriddns.Client(sess)
|
||||
|
||||
resourceRecordSets, err := client.GetRecordList(ctx, edgegriddns.GetRecordListRequest{
|
||||
Zone: zone,
|
||||
RecordType: "TXT",
|
||||
})
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
for i, rrset := range resourceRecordSets.RecordSets {
|
||||
if rrset.Name != fqdn {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package edgedns
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
configdns "github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v2"
|
||||
"github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
|
||||
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v11/pkg/edgegrid"
|
||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||
"github.com/go-acme/lego/v4/platform/tester"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
@ -21,6 +19,9 @@ const (
|
|||
)
|
||||
|
||||
var envTest = tester.NewEnvTest(
|
||||
EnvTTL,
|
||||
EnvPollingInterval,
|
||||
EnvPropagationTimeout,
|
||||
EnvHost,
|
||||
EnvClientToken,
|
||||
EnvClientSecret,
|
||||
|
|
@ -35,7 +36,7 @@ var envTest = tester.NewEnvTest(
|
|||
WithDomain(envDomain).
|
||||
WithLiveTestRequirements(EnvHost, EnvClientToken, EnvClientSecret, EnvAccessToken, envDomain)
|
||||
|
||||
func TestNewDNSProvider_FromEnv(t *testing.T) {
|
||||
func TestNewDNSProvider(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
envVars map[string]string
|
||||
|
|
@ -50,13 +51,13 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
EnvClientSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
EnvAccessToken: "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
},
|
||||
expectedConfig: &edgegrid.Config{
|
||||
Host: "akaa-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net",
|
||||
ClientToken: "akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
ClientSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
AccessToken: "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
MaxBody: maxBody,
|
||||
},
|
||||
expectedConfig: newEdgeConfig(func(config *edgegrid.Config) {
|
||||
config.Host = "akaa-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net"
|
||||
config.ClientToken = "akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx"
|
||||
config.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
config.AccessToken = "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx"
|
||||
config.MaxBody = maxBody
|
||||
}, edgegrid.WithEnv(true), edgegrid.WithFile("/dev/null")),
|
||||
},
|
||||
{
|
||||
desc: "with account switch key",
|
||||
|
|
@ -67,14 +68,14 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
EnvAccessToken: "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
EnvAccountSwitchKey: "F-AC-1234",
|
||||
},
|
||||
expectedConfig: &edgegrid.Config{
|
||||
Host: "akaa-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net",
|
||||
ClientToken: "akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
ClientSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
AccessToken: "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
MaxBody: maxBody,
|
||||
AccountKey: "F-AC-1234",
|
||||
},
|
||||
expectedConfig: newEdgeConfig(func(config *edgegrid.Config) {
|
||||
config.Host = "akaa-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net"
|
||||
config.ClientToken = "akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx"
|
||||
config.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
config.AccessToken = "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx"
|
||||
config.MaxBody = maxBody
|
||||
config.AccountKey = "F-AC-1234"
|
||||
}, edgegrid.WithEnv(true), edgegrid.WithFile("/dev/null")),
|
||||
},
|
||||
{
|
||||
desc: "with section",
|
||||
|
|
@ -85,17 +86,17 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
envTestClientSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
envTestAccessToken: "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
},
|
||||
expectedConfig: &edgegrid.Config{
|
||||
Host: "akaa-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net",
|
||||
ClientToken: "akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
ClientSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
AccessToken: "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
|
||||
MaxBody: maxBody,
|
||||
},
|
||||
expectedConfig: newEdgeConfig(func(config *edgegrid.Config) {
|
||||
config.Host = "akaa-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net"
|
||||
config.ClientToken = "akab-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx"
|
||||
config.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
config.AccessToken = "akac-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx"
|
||||
config.MaxBody = maxBody
|
||||
}, edgegrid.WithEnv(true), edgegrid.WithFile("/dev/null"), edgegrid.WithSection("test")),
|
||||
},
|
||||
{
|
||||
desc: "missing credentials",
|
||||
expectedErr: "edgedns: Unable to create instance using environment or .edgerc file",
|
||||
expectedErr: `edgedns: unable to load config from environment or .edgerc file`,
|
||||
},
|
||||
{
|
||||
desc: "missing host",
|
||||
|
|
@ -105,7 +106,7 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
EnvClientSecret: "C",
|
||||
EnvAccessToken: "D",
|
||||
},
|
||||
expectedErr: "edgedns: Unable to create instance using environment or .edgerc file",
|
||||
expectedErr: `edgedns: unable to load config from environment or .edgerc file`,
|
||||
},
|
||||
{
|
||||
desc: "missing client token",
|
||||
|
|
@ -115,7 +116,7 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
EnvClientSecret: "C",
|
||||
EnvAccessToken: "D",
|
||||
},
|
||||
expectedErr: "edgedns: Fatal missing required environment variables: [AKAMAI_CLIENT_TOKEN]",
|
||||
expectedErr: `edgedns: unable to load config from environment or .edgerc file`,
|
||||
},
|
||||
{
|
||||
desc: "missing client secret",
|
||||
|
|
@ -125,7 +126,7 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
EnvClientSecret: "",
|
||||
EnvAccessToken: "D",
|
||||
},
|
||||
expectedErr: "edgedns: Fatal missing required environment variables: [AKAMAI_CLIENT_SECRET]",
|
||||
expectedErr: `edgedns: unable to load config from environment or .edgerc file`,
|
||||
},
|
||||
{
|
||||
desc: "missing access token",
|
||||
|
|
@ -135,7 +136,7 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
EnvClientSecret: "C",
|
||||
EnvAccessToken: "",
|
||||
},
|
||||
expectedErr: "edgedns: Fatal missing required environment variables: [AKAMAI_ACCESS_TOKEN]",
|
||||
expectedErr: `edgedns: unable to load config from environment or .edgerc file`,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +148,7 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
if test.envVars == nil {
|
||||
test.envVars = map[string]string{}
|
||||
}
|
||||
|
||||
test.envVars[EnvEdgeRc] = "/dev/null"
|
||||
|
||||
envTest.Apply(test.envVars)
|
||||
|
|
@ -154,7 +156,7 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
p, err := NewDNSProvider()
|
||||
|
||||
if test.expectedErr != "" {
|
||||
require.EqualError(t, err, test.expectedErr)
|
||||
require.ErrorContains(t, err, test.expectedErr)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -163,13 +165,62 @@ func TestNewDNSProvider_FromEnv(t *testing.T) {
|
|||
require.NotNil(t, p.config)
|
||||
|
||||
if test.expectedConfig != nil {
|
||||
require.Equal(t, *test.expectedConfig, configdns.Config)
|
||||
require.Equal(t, test.expectedConfig, p.config.Config)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDNSProvider_findZone(t *testing.T) {
|
||||
func TestNewDefaultConfig(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
envVars map[string]string
|
||||
expected *Config
|
||||
}{
|
||||
{
|
||||
desc: "default configuration",
|
||||
expected: &Config{
|
||||
TTL: dns01.DefaultTTL,
|
||||
PropagationTimeout: 3 * time.Minute,
|
||||
PollingInterval: 15 * time.Second,
|
||||
Config: &edgegrid.Config{
|
||||
MaxBody: maxBody,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "custom values",
|
||||
envVars: map[string]string{
|
||||
EnvTTL: "99",
|
||||
EnvPropagationTimeout: "60",
|
||||
EnvPollingInterval: "60",
|
||||
},
|
||||
expected: &Config{
|
||||
TTL: 99,
|
||||
PropagationTimeout: 60 * time.Second,
|
||||
PollingInterval: 60 * time.Second,
|
||||
Config: &edgegrid.Config{
|
||||
MaxBody: maxBody,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
defer envTest.RestoreEnv()
|
||||
envTest.ClearEnv()
|
||||
|
||||
envTest.Apply(test.envVars)
|
||||
|
||||
config := NewDefaultConfig()
|
||||
|
||||
require.Equal(t, test.expected, config)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_findZone(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
domain string
|
||||
|
|
@ -198,53 +249,7 @@ func TestDNSProvider_findZone(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestNewDefaultConfig(t *testing.T) {
|
||||
defer envTest.RestoreEnv()
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
envVars map[string]string
|
||||
expected *Config
|
||||
}{
|
||||
{
|
||||
desc: "default configuration",
|
||||
expected: &Config{
|
||||
TTL: dns01.DefaultTTL,
|
||||
PropagationTimeout: 3 * time.Minute,
|
||||
PollingInterval: 15 * time.Second,
|
||||
Config: edgegrid.Config{
|
||||
MaxBody: maxBody,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "custom values",
|
||||
envVars: map[string]string{
|
||||
EnvTTL: "99",
|
||||
EnvPropagationTimeout: "60",
|
||||
EnvPollingInterval: "60",
|
||||
},
|
||||
expected: &Config{
|
||||
TTL: 99,
|
||||
PropagationTimeout: 60 * time.Second,
|
||||
PollingInterval: 60 * time.Second,
|
||||
Config: edgegrid.Config{
|
||||
MaxBody: maxBody,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
envTest.ClearEnv()
|
||||
for key, value := range test.envVars {
|
||||
os.Setenv(key, value)
|
||||
}
|
||||
|
||||
config := NewDefaultConfig()
|
||||
|
||||
require.Equal(t, test.expected, config)
|
||||
})
|
||||
}
|
||||
func newEdgeConfig(opts ...edgegrid.Option) *edgegrid.Config {
|
||||
config, _ := edgegrid.New(opts...)
|
||||
return config
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue