Skip to content

Commit

Permalink
Show fresh list of domains instead of cached one
Browse files Browse the repository at this point in the history
  • Loading branch information
sibprogrammer committed Jun 16, 2021
1 parent 5f4ae45 commit dca79e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/domains/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var reloadCmd = &cobra.Command{
}

cmd.SilenceUsage = true
err = actions.DomainReload(*server)
err = actions.DomainReload(server)

if err == nil {
utils.Log.PrintL("domain.reload.success")
Expand Down
4 changes: 2 additions & 2 deletions internal/actions/domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func DomainAdd(host types.Server, domain string, ipa types.ServerIPAddresses) er
}

func DomainList(host types.Server) error {
err := DomainReload(host)
err := DomainReload(&host)
if err != nil {
return err
}
Expand All @@ -87,7 +87,7 @@ func DomainList(host types.Server) error {
return w.Flush()
}

func DomainReload(host types.Server) error {
func DomainReload(host *types.Server) error {
api := factory.GetDomainManagement(host.GetServerAuth())
domains, err := api.ListDomains()
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/config/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ func SetServers(newData []types.Server) {
globalConfig.config.Server = newData
}

func SetDomains(host types.Server, newData []types.Domain) {
func SetDomains(host *types.Server, newData []types.Domain) {
servers, _ := utils.FilterServers(GetServers(), host.Host)
host.Domains = newData
SetServers(append([]types.Server{host}, servers...))
SetServers(append([]types.Server{*host}, servers...))
}

func SetDomain(host types.Server, domain types.Domain) {
domains, _ := utils.FilterDomains(host.Domains, domain.Name)
SetDomains(host, append(domains, domain))
SetDomains(&host, append(domains, domain))
}

0 comments on commit dca79e5

Please sign in to comment.