Skip to content

Commit e2b4936

Browse files
committed
Fix initial app deployment
1 parent dca79e5 commit e2b4936

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

cmd/deploy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,17 @@ var deployCmd = &cobra.Command{
4141
domain, err = config.GetDomain(*server, domainName)
4242
if err != nil {
4343
fmt.Printf("Creating the domain %s...\n", domainName)
44-
err = actions.DomainAdd(*server, domainName, types.ServerIPAddresses{
44+
err = actions.DomainAdd(server, domainName, types.ServerIPAddresses{
4545
IPv4: []string{defaultIp},
4646
})
4747
if err != nil {
4848
return err
4949
}
5050
fmt.Println("Domain has been created.")
51+
domain, err = config.GetDomain(*server, domainName)
52+
if err != nil {
53+
return err
54+
}
5155
} else {
5256
fmt.Printf("Domain %s has been found.\n", domainName)
5357
}

cmd/domains/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var createCmd = &cobra.Command{
4141
}
4242

4343
cmd.SilenceUsage = true
44-
err = actions.DomainAdd(*server, args[1], ips)
44+
err = actions.DomainAdd(server, args[1], ips)
4545

4646
if err == nil {
4747
utils.Log.PrintL("domain.create.success", args[1])

internal/actions/databases.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func DatabaseAdd(host types.Server, domain types.Domain, dbs types.DatabaseServe
4949
DatabaseServerID: newdb.DatabaseServerID,
5050
})
5151

52-
config.SetDomain(host, domain)
52+
config.SetDomain(&host, domain)
5353
return nil
5454
}
5555

@@ -95,7 +95,7 @@ func DatabaseDeploy(host types.Server, domain types.Domain, db types.Database, f
9595
}
9696

9797
domain.DatabaseUsers = append(domain.DatabaseUsers, *dbu)
98-
config.SetDomain(host, domain)
98+
config.SetDomain(&host, domain)
9999
}
100100

101101
var s *string

internal/actions/domains.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func validateIps(val types.ServerIPAddresses, comp types.ServerIPAddresses) (boo
4242
return v4Valid, v6Valid
4343
}
4444

45-
func DomainAdd(host types.Server, domain string, ipa types.ServerIPAddresses) error {
46-
_, err := config.GetDomain(host, domain)
45+
func DomainAdd(host *types.Server, domain string, ipa types.ServerIPAddresses) error {
46+
_, err := config.GetDomain(*host, domain)
4747
if err == nil {
4848
return errors.New(locales.L.Get("errors.domain.already.exists", domain))
4949
}

internal/actions/ftp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func FtpUserCreate(host types.Server, domain types.Domain, user *types.FtpUser)
3131
}
3232

3333
domain.FTPUsers = append(domain.FTPUsers, *user)
34-
config.SetDomain(host, domain)
34+
config.SetDomain(&host, domain)
3535

3636
return user, nil
3737
}

internal/config/global.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func DeleteDatabase(host types.Server, dbn string) {
146146
}
147147

148148
if domain != nil {
149-
SetDomain(host, *domain)
149+
SetDomain(&host, *domain)
150150
}
151151
}
152152

@@ -162,7 +162,7 @@ func SetDomains(host *types.Server, newData []types.Domain) {
162162
SetServers(append([]types.Server{*host}, servers...))
163163
}
164164

165-
func SetDomain(host types.Server, domain types.Domain) {
165+
func SetDomain(host *types.Server, domain types.Domain) {
166166
domains, _ := utils.FilterDomains(host.Domains, domain.Name)
167-
SetDomains(&host, append(domains, domain))
167+
SetDomains(host, append(domains, domain))
168168
}

0 commit comments

Comments
 (0)