Skip to content

Commit

Permalink
Update provider
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakovri committed Aug 4, 2024
1 parent 0ba8cc2 commit faf4528
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21.5

require (
github.com/caddyserver/caddy/v2 v2.7.6
github.com/profcomff/libdns-yandex-cloud v0.0.0-20240804182925-41d9be60a040
github.com/profcomff/libdns-yandex-cloud v0.0.0-20240804191736-c413779159d2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/profcomff/libdns-yandex-cloud v0.0.0-20240804182925-41d9be60a040 h1:hoSbWAGZRkuik7W5yyFj5HnIOR83Lm4jutgl+j+U42s=
github.com/profcomff/libdns-yandex-cloud v0.0.0-20240804182925-41d9be60a040/go.mod h1:5x0hOozXCCSNJEznJ9ptgOcquDpnW4gSfYcdXo6MLaU=
github.com/profcomff/libdns-yandex-cloud v0.0.0-20240804191736-c413779159d2 h1:Krf57TZeOp9ld87x+1R6EG3CDWoqHxnCThOq82N4624=
github.com/profcomff/libdns-yandex-cloud v0.0.0-20240804191736-c413779159d2/go.mod h1:5x0hOozXCCSNJEznJ9ptgOcquDpnW4gSfYcdXo6MLaU=
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY=
Expand Down
17 changes: 5 additions & 12 deletions module.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package caddy_dns_yandex_cloud
import (
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
libdns "github.com/profcomff/libdns-yandex-cloud"
yandex_cloud "github.com/profcomff/libdns-yandex-cloud"
)

// Provider wraps the provider implementation as a Caddy module.
type Provider struct{ *libdns.Provider }
type Provider struct{ *yandex_cloud.Provider }

func init() {
caddy.RegisterModule(Provider{})
Expand All @@ -17,7 +17,7 @@ func init() {
func (Provider) CaddyModule() caddy.ModuleInfo {
return caddy.ModuleInfo{
ID: "dns.providers.yandex_cloud",
New: func() caddy.Module { return &Provider{new(libdns.Provider)} },
New: func() caddy.Module { return &Provider{new(yandex_cloud.Provider)} },
}
}

Expand All @@ -31,8 +31,8 @@ func (p *Provider) Provision(ctx caddy.Context) error {

// UnmarshalCaddyfile sets up the DNS provider from Caddyfile tokens. Syntax:
//
// libdns [<service_account_config_path>] {
// service_account_config_path <json config path> ~/.yc/config.json for example
// yandex_cloud [<service_account_config_path>] {
// service_account_config_path <service_account_config_path>
// }
//
func (p *Provider) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
Expand All @@ -46,13 +46,6 @@ func (p *Provider) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
for nesting := d.Nesting(); d.NextBlock(nesting); {
switch d.Val() {
case "service_account_config_path":
err := p.Provider.SetServiceConfig(d.Val())
if err != nil{
return err
}
if p.Provider.ServiceAccountConfigPath != "" {
return d.Err("config_path already set")
}
p.Provider.ServiceAccountConfigPath = d.Val()
if d.NextArg() {
return d.ArgErr()
Expand Down

0 comments on commit faf4528

Please sign in to comment.