feat: complete 2.0.7.12 platform overhaul
This commit is contained in:
@@ -11,7 +11,10 @@ import (
|
||||
|
||||
const DefaultListen = ":33550"
|
||||
|
||||
var Version = "0.1.0"
|
||||
var (
|
||||
Version = "0.1.0"
|
||||
AdminBuildID = "dev"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
BaseDir string `json:"base_dir"`
|
||||
@@ -26,6 +29,7 @@ type Config struct {
|
||||
UpdateNoticeDir string `json:"update_notice_dir"`
|
||||
DownloadsDir string `json:"downloads_dir"`
|
||||
AdminWebDir string `json:"admin_web_dir"`
|
||||
AdminAssetMode string `json:"admin_asset_mode"`
|
||||
PortalWebDir string `json:"portal_web_dir"`
|
||||
SetupWebDir string `json:"setup_web_dir"`
|
||||
LegacyUpdateDir string `json:"legacy_update_dir"`
|
||||
@@ -140,6 +144,7 @@ func defaults(root string) *Config {
|
||||
UpdateNoticeDir: filepath.Join(root, "data", "update-notice"),
|
||||
DownloadsDir: filepath.Join(root, "data", "update", "public", "downloads"),
|
||||
AdminWebDir: filepath.Join(root, "web", "admin", "dist"),
|
||||
AdminAssetMode: defaultAdminAssetMode(),
|
||||
PortalWebDir: filepath.Join(root, "web", "portal", "dist"),
|
||||
SetupWebDir: filepath.Join(root, "web", "setup", "dist"),
|
||||
LegacyUpdateDir: filepath.Clean(filepath.Join(root, "..", "update")),
|
||||
@@ -225,6 +230,9 @@ func applyEnv(cfg *Config) {
|
||||
if value := os.Getenv("YMHUT_DOWNLOADS_DIR"); value != "" {
|
||||
cfg.DownloadsDir = value
|
||||
}
|
||||
if value := os.Getenv("YMHUT_ADMIN_ASSET_MODE"); value != "" {
|
||||
cfg.AdminAssetMode = value
|
||||
}
|
||||
if value := os.Getenv("YMHUT_LEGACY_UPDATE_DIR"); value != "" {
|
||||
cfg.LegacyUpdateDir = value
|
||||
}
|
||||
@@ -386,6 +394,10 @@ func normalize(root string, cfg *Config) {
|
||||
cfg.AdminWebDir = filepath.Join(cfg.BaseDir, "web", "admin", "dist")
|
||||
}
|
||||
cfg.AdminWebDir = absPath(cfg.BaseDir, cfg.AdminWebDir)
|
||||
cfg.AdminAssetMode = strings.ToLower(strings.TrimSpace(cfg.AdminAssetMode))
|
||||
if cfg.AdminAssetMode != "embedded" && cfg.AdminAssetMode != "disk" {
|
||||
cfg.AdminAssetMode = defaultAdminAssetMode()
|
||||
}
|
||||
if cfg.PortalWebDir == "" {
|
||||
cfg.PortalWebDir = filepath.Join(cfg.BaseDir, "web", "portal", "dist")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user