diff options
Diffstat (limited to 'internal/conf/static.go')
-rw-r--r-- | internal/conf/static.go | 173 |
1 files changed, 92 insertions, 81 deletions
diff --git a/internal/conf/static.go b/internal/conf/static.go index aa73a180..b0092dde 100644 --- a/internal/conf/static.go +++ b/internal/conf/static.go @@ -13,6 +13,9 @@ import ( ) // ℹ️ README: This file contains static values that should only be set at initialization time. +// +// ⚠️ WARNING: After changing any options, do not forget to update template of +// "/admin/config" page as well. // HasMinWinSvc is whether the application is built with Windows Service support. // @@ -30,67 +33,7 @@ var ( // CustomConf returns the absolute path of custom configuration file that is used. var CustomConf string -// ⚠️ WARNING: After changing the following section, do not forget to update template of -// "/admin/config" page as well. var ( - // Application settings - App struct { - // ⚠️ WARNING: Should only be set by the main package (i.e. "gogs.go"). - Version string `ini:"-"` - - BrandName string - RunUser string - RunMode string - } - - // SSH settings - SSH struct { - Disabled bool `ini:"DISABLE_SSH"` - Domain string `ini:"SSH_DOMAIN"` - Port int `ini:"SSH_PORT"` - RootPath string `ini:"SSH_ROOT_PATH"` - KeygenPath string `ini:"SSH_KEYGEN_PATH"` - KeyTestPath string `ini:"SSH_KEY_TEST_PATH"` - MinimumKeySizeCheck bool - MinimumKeySizes map[string]int `ini:"-"` // Load from [ssh.minimum_key_sizes] - RewriteAuthorizedKeysAtStart bool - - StartBuiltinServer bool `ini:"START_SSH_SERVER"` - ListenHost string `ini:"SSH_LISTEN_HOST"` - ListenPort int `ini:"SSH_LISTEN_PORT"` - ServerCiphers []string `ini:"SSH_SERVER_CIPHERS"` - ServerMACs []string `ini:"SSH_SERVER_MACS"` - } - - // Repository settings - Repository struct { - Root string - ScriptType string - ANSICharset string `ini:"ANSI_CHARSET"` - ForcePrivate bool - MaxCreationLimit int - PreferredLicenses []string - DisableHTTPGit bool `ini:"DISABLE_HTTP_GIT"` - EnableLocalPathMigration bool - EnableRawFileRenderMode bool - CommitsFetchConcurrency int - - // Repository editor settings - Editor struct { - LineWrapExtensions []string - PreviewableFileModes []string - } `ini:"repository.editor"` - - // Repository upload settings - Upload struct { - Enabled bool - TempPath string - AllowedTypes []string `delim:"|"` - FileMaxSize int64 - MaxFiles int - } `ini:"repository.upload"` - } - // Security settings Security struct { InstallLock bool @@ -295,27 +238,6 @@ var ( MaxResponseItems int } - // UI settings - UI struct { - ExplorePagingNum int - IssuePagingNum int - FeedMaxCommitNum int - ThemeColorMetaTag string - MaxDisplayFileSize int64 - - Admin struct { - UserPagingNum int - RepoPagingNum int - NoticePagingNum int - OrgPagingNum int - } `ini:"ui.admin"` - User struct { - RepoPagingNum int - NewsFeedPagingNum int - CommitsPagingNum int - } `ini:"ui.user"` - } - // Prometheus settings Prometheus struct { Enabled bool @@ -334,6 +256,18 @@ var ( HasRobotsTxt bool ) +type AppOpts struct { + // ⚠️ WARNING: Should only be set by the main package (i.e. "gogs.go"). + Version string `ini:"-"` + + BrandName string + RunUser string + RunMode string +} + +// Application settings +var App AppOpts + type ServerOpts struct { ExternalURL string `ini:"EXTERNAL_URL"` Domain string @@ -365,6 +299,58 @@ type ServerOpts struct { // Server settings var Server ServerOpts +type SSHOpts struct { + Disabled bool `ini:"DISABLE_SSH"` + Domain string `ini:"SSH_DOMAIN"` + Port int `ini:"SSH_PORT"` + RootPath string `ini:"SSH_ROOT_PATH"` + KeygenPath string `ini:"SSH_KEYGEN_PATH"` + KeyTestPath string `ini:"SSH_KEY_TEST_PATH"` + MinimumKeySizeCheck bool + MinimumKeySizes map[string]int `ini:"-"` // Load from [ssh.minimum_key_sizes] + RewriteAuthorizedKeysAtStart bool + + StartBuiltinServer bool `ini:"START_SSH_SERVER"` + ListenHost string `ini:"SSH_LISTEN_HOST"` + ListenPort int `ini:"SSH_LISTEN_PORT"` + ServerCiphers []string `ini:"SSH_SERVER_CIPHERS"` + ServerMACs []string `ini:"SSH_SERVER_MACS"` +} + +// SSH settings +var SSH SSHOpts + +type RepositoryOpts struct { + Root string + ScriptType string + ANSICharset string `ini:"ANSI_CHARSET"` + ForcePrivate bool + MaxCreationLimit int + PreferredLicenses []string + DisableHTTPGit bool `ini:"DISABLE_HTTP_GIT"` + EnableLocalPathMigration bool + EnableRawFileRenderMode bool + CommitsFetchConcurrency int + + // Repository editor settings + Editor struct { + LineWrapExtensions []string + PreviewableFileModes []string + } `ini:"repository.editor"` + + // Repository upload settings + Upload struct { + Enabled bool + TempPath string + AllowedTypes []string `delim:"|"` + FileMaxSize int64 + MaxFiles int + } `ini:"repository.upload"` +} + +// Repository settings +var Repository RepositoryOpts + type DatabaseOpts struct { Type string Host string @@ -389,6 +375,31 @@ type LFSOpts struct { // LFS settings var LFS LFSOpts +type UIUserOpts struct { + RepoPagingNum int + NewsFeedPagingNum int + CommitsPagingNum int +} + +type UIOpts struct { + ExplorePagingNum int + IssuePagingNum int + FeedMaxCommitNum int + ThemeColorMetaTag string + MaxDisplayFileSize int64 + + Admin struct { + UserPagingNum int + RepoPagingNum int + NoticePagingNum int + OrgPagingNum int + } `ini:"ui.admin"` + User UIUserOpts `ini:"ui.user"` +} + +// UI settings +var UI UIOpts + type i18nConf struct { Langs []string `delim:","` Names []string `delim:","` |