aboutsummaryrefslogtreecommitdiff
path: root/internal/conf/static.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/conf/static.go')
-rw-r--r--internal/conf/static.go82
1 files changed, 42 insertions, 40 deletions
diff --git a/internal/conf/static.go b/internal/conf/static.go
index 8daebe79..35d1a8f4 100644
--- a/internal/conf/static.go
+++ b/internal/conf/static.go
@@ -46,40 +46,6 @@ var (
AppName string
}
- // Server settings
- Server struct {
- ExternalURL string `ini:"EXTERNAL_URL"`
- Domain string
- Protocol string
- HTTPAddr string `ini:"HTTP_ADDR"`
- HTTPPort string `ini:"HTTP_PORT"`
- CertFile string
- KeyFile string
- TLSMinVersion string `ini:"TLS_MIN_VERSION"`
- UnixSocketPermission string
- LocalRootURL string `ini:"LOCAL_ROOT_URL"`
-
- OfflineMode bool
- DisableRouterLog bool
- EnableGzip bool
-
- AppDataPath string
- LoadAssetsFromDisk bool
-
- LandingURL string `ini:"LANDING_URL"`
-
- // Derived from other static values
- URL *url.URL `ini:"-"` // Parsed URL object of ExternalURL.
- Subpath string `ini:"-"` // Subpath found the ExternalURL. Should be empty when not found.
- SubpathDepth int `ini:"-"` // The number of slashes found in the Subpath.
- UnixSocketMode os.FileMode `ini:"-"` // Parsed file mode of UnixSocketPermission.
-
- // Deprecated: Use ExternalURL instead, will be removed in 0.13.
- RootURL string `ini:"ROOT_URL"`
- // Deprecated: Use LandingURL instead, will be removed in 0.13.
- LangdingPage string `ini:"LANDING_PAGE"`
- }
-
// SSH settings
SSH struct {
Disabled bool `ini:"DISABLE_SSH"`
@@ -127,9 +93,6 @@ var (
} `ini:"repository.upload"`
}
- // Database settings
- Database DatabaseOpts
-
// Security settings
Security struct {
InstallLock bool
@@ -279,9 +242,6 @@ var (
DefaultInterval int
}
- // I18n settings
- I18n *i18nConf
-
// Webhook settings
Webhook struct {
Types []string
@@ -401,6 +361,42 @@ var (
HasRobotsTxt bool
)
+type ServerOpts struct {
+ ExternalURL string `ini:"EXTERNAL_URL"`
+ Domain string
+ Protocol string
+ HTTPAddr string `ini:"HTTP_ADDR"`
+ HTTPPort string `ini:"HTTP_PORT"`
+ CertFile string
+ KeyFile string
+ TLSMinVersion string `ini:"TLS_MIN_VERSION"`
+ UnixSocketPermission string
+ LocalRootURL string `ini:"LOCAL_ROOT_URL"`
+
+ OfflineMode bool
+ DisableRouterLog bool
+ EnableGzip bool
+
+ AppDataPath string
+ LoadAssetsFromDisk bool
+
+ LandingURL string `ini:"LANDING_URL"`
+
+ // Derived from other static values
+ URL *url.URL `ini:"-"` // Parsed URL object of ExternalURL.
+ Subpath string `ini:"-"` // Subpath found the ExternalURL. Should be empty when not found.
+ SubpathDepth int `ini:"-"` // The number of slashes found in the Subpath.
+ UnixSocketMode os.FileMode `ini:"-"` // Parsed file mode of UnixSocketPermission.
+
+ // Deprecated: Use ExternalURL instead, will be removed in 0.13.
+ RootURL string `ini:"ROOT_URL"`
+ // Deprecated: Use LandingURL instead, will be removed in 0.13.
+ LangdingPage string `ini:"LANDING_PAGE"`
+}
+
+// Server settings
+var Server ServerOpts
+
type DatabaseOpts struct {
Type string
Host string
@@ -418,6 +414,9 @@ type DatabaseOpts struct {
Passwd string
}
+// Database settings
+var Database DatabaseOpts
+
type i18nConf struct {
Langs []string `delim:","`
Names []string `delim:","`
@@ -433,6 +432,9 @@ func (c *i18nConf) DateLang(lang string) string {
return "en"
}
+// I18n settings
+var I18n *i18nConf
+
// handleDeprecated transfers deprecated values to the new ones when set.
func handleDeprecated() {
if App.AppName != "" {