Skip to content

Commit

Permalink
Merge pull request #23 from andrke/add_app-domain_feature
Browse files Browse the repository at this point in the history
Add --app-domain feature
  • Loading branch information
kertkukk authored Dec 2, 2021
2 parents 371ea6c + 3f873d5 commit 403bbb7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions internal/app/gitops/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func copyAndDeleteSpecificFlags(baseFlags []cli.Flag) []cli.Flag {
baseFlags = append(baseFlags, &appBranchFlag)
baseFlags = append(baseFlags, &appPrefixArgoFlag)
baseFlags = append(baseFlags, &appPrefixYamlFlag)
baseFlags = append(baseFlags, &appDomainFlag)
return baseFlags
}

Expand Down Expand Up @@ -170,6 +171,14 @@ var appBranchFlag = cli.StringFlag{
Required: true,
}

var appDomainFlag = cli.StringFlag{
Name: "app-domain",
EnvVars: []string{"APP_DOMAIN"},
DefaultText: "localhost",
Usage: "application domain",
Destination: &flags.App.Domain,
}

var appPrefixArgoFlag = cli.StringFlag{
Name: "app-prefix-argo",
EnvVars: []string{"APP_PREFIX_ARGO"},
Expand Down
2 changes: 1 addition & 1 deletion internal/app/gitops/commands/copy/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func copyMasterToNewBranch(flags *common.Flags) {
func installViaFile(flags *common.Flags) {
installer := configInstaller.Installer{Command: common.CopyCmd, DeploymentStrategy: common.UnspecifiedStrategy}
installTxt := string(common.GetFileInput(installFile))
installTxtVars := *initInstallTxtVariables(flags.App.Branch, flags.App.Name)
installTxtVars := *initInstallTxtVariables(flags.App.Branch, flags.App.Name, flags.App.Domain)
installTxt = installTxtVars.specifyInstallVariables(installTxt)
input := composeInstallInput(installTxt)
installer.Install(input)
Expand Down
4 changes: 2 additions & 2 deletions internal/app/gitops/commands/copy/install_txt_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ type installTxtVariables struct {
featureUrl string
}

func initInstallTxtVariables(appBranch string, appName string) *installTxtVariables {
func initInstallTxtVariables(appBranch string, appName string, appDomain string) *installTxtVariables {
featureUrl := ""
if appBranch == "master" {
featureUrl = appName
} else {
featureUrl = fmt.Sprintf("%s-%s.fleetcomplete.dev", appName, appBranch)
featureUrl = fmt.Sprintf("%s-%s.%s", appName, appBranch, appDomain)
}
return &installTxtVariables{appBranch: appBranch, appName: appName, featureUrl: featureUrl}
}
Expand Down
1 change: 1 addition & 0 deletions internal/app/gitops/common/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type AppFlags struct {
Branch string
PrefixArgo string
PrefixYaml string
Domain string
}

type ArgoCDFlags struct {
Expand Down

0 comments on commit 403bbb7

Please sign in to comment.