Skip to content

Commit

Permalink
Merge pull request #55 from sail-host/master
Browse files Browse the repository at this point in the history
add app url
  • Loading branch information
Firdavs9512 authored Nov 21, 2024
2 parents b101959 + 9a61d9f commit dd20112
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/config/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ type System struct {
Mode string `mapstructure:"mode"`
DeployDir string `mapstructure:"deploy_dir"`
UtilsDir string `mapstructure:"utils_dir"`
AppUrl string `mapstructure:"app_url"`
}
4 changes: 3 additions & 1 deletion internal/init/viper/viper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package viper

import (
"fmt"
"log"
"os"
"path"
Expand Down Expand Up @@ -91,6 +92,7 @@ func setViperConfig(cfg config.Config) {
viper.Set("system.encrypt_key", cfg.System.EncryptKey)
viper.Set("system.deploy_dir", cfg.System.DeployDir)
viper.Set("system.utils_dir", cfg.System.UtilsDir)
viper.Set("system.app_url", cfg.System.AppUrl)
}

// Create config file
Expand Down Expand Up @@ -126,6 +128,6 @@ func createConfig(devMode bool, configDir string) config.Config {
rootConfig.System.DeployDir = path.Join(configDir, "deploy")
rootConfig.System.UtilsDir = path.Join(configDir, "utils")
rootConfig.System.EncryptKey = random.StringGenerator(32)

rootConfig.System.AppUrl = fmt.Sprintf("http://%s:%s", rootConfig.System.BindAddress, rootConfig.System.Port)
return rootConfig
}

0 comments on commit dd20112

Please sign in to comment.