Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 9d036e7

Browse files
committed
feat: consider destroy for DNS modules
1 parent a1fad82 commit 9d036e7

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

commands/project/destroy.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ var DestroyApplication = &cobra.Command{
5656
return err
5757
}
5858

59+
// Run destroy scripts from DNS plugins
60+
for _, module := range system.Context.DNSModules {
61+
if module.GetConfig().Type != "dns" {
62+
continue
63+
}
64+
moduleSettings := system.GetModuleSettings(module.GetConfig().Name)
65+
if err := module.(system.DNSModule).Destroy(moduleSettings); err != nil {
66+
return err
67+
}
68+
}
69+
5970
return nil
6071
},
6172
})

commands/setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ var SetupServer = &cobra.Command{
261261
modules := system.Context.GetModulesInOrder()
262262
event.MustFire("setup.modules.pre-install", event.M{"modules": modules})
263263
for _, module := range modules {
264-
if module.GetConfig().Type == "plugin" {
264+
if module.GetConfig().Type == "plugin" || module.GetConfig().Type == "dns" {
265265
continue
266266
}
267267
event.MustFire(

project/structs.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ type DomainSecurity struct {
2424
Authentication []DomainSecurityAuthentication `yaml:"authentication,omitempty"`
2525
}
2626

27+
type DNSSettings struct {
28+
Provider string
29+
}
30+
2731
type Domains struct {
2832
Domain string
2933
Expose []DomainExpose
3034
Security DomainSecurity `yaml:"security,omitempty"`
35+
DNS DNSSettings `yaml:"dns,omitempty"`
3136
}
3237

3338
type Registries struct {

system/modules.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ type Module interface {
4646
GetConfig() ModuleConfig
4747
GetTemplates() *embed.FS
4848
}
49+
type DNSModule interface {
50+
Destroy(moduleSettings interface{}) error
51+
}
4952

5053
type PluginModule interface {
5154
Init(moduleSettings interface{})

0 commit comments

Comments
 (0)