gitea: code.gitea.io/gitea/modules/setting Index | Files

package setting

import "code.gitea.io/gitea/modules/setting"

Index

Package Files

attachment.go cache.go cors.go cron.go database.go git.go indexer.go lfs.go log.go mailer.go markup.go migrations.go picture.go project.go queue.go repository.go service.go session.go setting.go storage.go task.go webhook.go

Constants

const (
    LevelQueueType   = "levelqueue"
    ChannelQueueType = "channel"
    RedisQueueType   = "redis"
)

enumerates all the indexer queue types

const (
    RepoCreatingLastUserVisibility = "last"
    RepoCreatingPrivate            = "private"
    RepoCreatingPublic             = "public"
)

enumerates all the policy repository creating

const (
    ImageCaptcha = "image"
    ReCaptcha    = "recaptcha"
    HCaptcha     = "hcaptcha"
)

enumerates all the types of captchas

Variables

var (
    // SupportedDatabases includes all supported databases type
    SupportedDatabases = []string{"MySQL", "PostgreSQL", "MSSQL"}

    // EnableSQLite3 use SQLite3, set by build flag
    EnableSQLite3 bool

    // Database holds the database settings
    Database = struct {
        Type              string
        Host              string
        Name              string
        User              string
        Passwd            string
        Schema            string
        SSLMode           string
        Path              string
        LogSQL            bool
        Charset           string
        Timeout           int // seconds
        UseSQLite3        bool
        UseMySQL          bool
        UseMSSQL          bool
        UsePostgreSQL     bool
        DBConnectRetries  int
        DBConnectBackoff  time.Duration
        MaxIdleConns      int
        MaxOpenConns      int
        ConnMaxLifetime   time.Duration
        IterateBufferSize int
    }{
        Timeout:           500,
        IterateBufferSize: 50,
    }
)
var (
    ExternalMarkupParsers  []MarkupParser
    ExternalSanitizerRules []MarkupSanitizerRule
)

ExternalMarkupParsers represents the external markup parsers

var (
    // Picture settings
    Avatar = struct {
        Storage

        MaxWidth    int
        MaxHeight   int
        MaxFileSize int64
    }{
        MaxWidth:    4096,
        MaxHeight:   3072,
        MaxFileSize: 1048576,
    }

    GravatarSource        string
    GravatarSourceURL     *url.URL
    DisableGravatar       bool
    EnableFederatedAvatar bool
    LibravatarService     *libravatar.Libravatar

    RepoAvatar = struct {
        Storage

        Fallback      string
        FallbackImage string
    }{}
)

settings

var (
    Repository = struct {
        DetectedCharsetsOrder                   []string
        DetectedCharsetScore                    map[string]int `ini:"-"`
        AnsiCharset                             string
        ForcePrivate                            bool
        DefaultPrivate                          string
        DefaultPushCreatePrivate                bool
        MaxCreationLimit                        int
        MirrorQueueLength                       int
        PullRequestQueueLength                  int
        PreferredLicenses                       []string
        DisableHTTPGit                          bool
        AccessControlAllowOrigin                string
        UseCompatSSHURI                         bool
        DefaultCloseIssuesViaCommitsInAnyBranch bool
        EnablePushCreateUser                    bool
        EnablePushCreateOrg                     bool
        DisabledRepoUnits                       []string
        DefaultRepoUnits                        []string
        PrefixArchiveFiles                      bool
        DisableMirrors                          bool
        DisableMigrations                       bool
        DefaultBranch                           string
        AllowAdoptionOfUnadoptedRepositories    bool
        AllowDeleteOfUnadoptedRepositories      bool

        // Repository editor settings
        Editor struct {
            LineWrapExtensions   []string
            PreviewableFileModes []string
        }   `ini:"-"`

        // Repository upload settings
        Upload struct {
            Enabled      bool
            TempPath     string
            AllowedTypes string
            FileMaxSize  int64
            MaxFiles     int
        }   `ini:"-"`

        // Repository local settings
        Local struct {
            LocalCopyPath string
        }   `ini:"-"`

        // Pull request settings
        PullRequest struct {
            WorkInProgressPrefixes                   []string
            CloseKeywords                            []string
            ReopenKeywords                           []string
            DefaultMergeMessageCommitsLimit          int
            DefaultMergeMessageSize                  int
            DefaultMergeMessageAllAuthors            bool
            DefaultMergeMessageMaxApprovers          int
            DefaultMergeMessageOfficialApproversOnly bool
        }   `ini:"repository.pull-request"`

        // Issue Setting
        Issue struct {
            LockReasons []string
        }   `ini:"repository.issue"`

        Release struct {
            AllowedTypes string
        }   `ini:"repository.release"`

        Signing struct {
            SigningKey        string
            SigningName       string
            SigningEmail      string
            InitialCommit     []string
            CRUDActions       []string `ini:"CRUD_ACTIONS"`
            Merges            []string
            Wiki              []string
            DefaultTrustModel string
        }   `ini:"repository.signing"`
    }{
        DetectedCharsetsOrder: []string{
            "UTF-8",
            "UTF-16BE",
            "UTF-16LE",
            "UTF-32BE",
            "UTF-32LE",
            "ISO-8859-1",
            "windows-1252",
            "ISO-8859-2",
            "windows-1250",
            "ISO-8859-5",
            "ISO-8859-6",
            "ISO-8859-7",
            "windows-1253",
            "ISO-8859-8-I",
            "windows-1255",
            "ISO-8859-8",
            "windows-1251",
            "windows-1256",
            "KOI8-R",
            "ISO-8859-9",
            "windows-1254",
            "Shift_JIS",
            "GB18030",
            "EUC-JP",
            "EUC-KR",
            "Big5",
            "ISO-2022-JP",
            "ISO-2022-KR",
            "ISO-2022-CN",
            "IBM424_rtl",
            "IBM424_ltr",
            "IBM420_rtl",
            "IBM420_ltr",
        },
        DetectedCharsetScore:                    map[string]int{},
        AnsiCharset:                             "",
        ForcePrivate:                            false,
        DefaultPrivate:                          RepoCreatingLastUserVisibility,
        DefaultPushCreatePrivate:                true,
        MaxCreationLimit:                        -1,
        MirrorQueueLength:                       1000,
        PullRequestQueueLength:                  1000,
        PreferredLicenses:                       []string{"Apache License 2.0", "MIT License"},
        DisableHTTPGit:                          false,
        AccessControlAllowOrigin:                "",
        UseCompatSSHURI:                         false,
        DefaultCloseIssuesViaCommitsInAnyBranch: false,
        EnablePushCreateUser:                    false,
        EnablePushCreateOrg:                     false,
        DisabledRepoUnits:                       []string{},
        DefaultRepoUnits:                        []string{},
        PrefixArchiveFiles:                      true,
        DisableMirrors:                          false,
        DisableMigrations:                       false,
        DefaultBranch:                           "master",

        Editor: struct {
            LineWrapExtensions   []string
            PreviewableFileModes []string
        }{
            LineWrapExtensions:   strings.Split(".txt,.md,.markdown,.mdown,.mkd,", ","),
            PreviewableFileModes: []string{"markdown"},
        },

        Upload: struct {
            Enabled      bool
            TempPath     string
            AllowedTypes string
            FileMaxSize  int64
            MaxFiles     int
        }{
            Enabled:      true,
            TempPath:     "data/tmp/uploads",
            AllowedTypes: "",
            FileMaxSize:  3,
            MaxFiles:     5,
        },

        Local: struct {
            LocalCopyPath string
        }{
            LocalCopyPath: "tmp/local-repo",
        },

        PullRequest: struct {
            WorkInProgressPrefixes                   []string
            CloseKeywords                            []string
            ReopenKeywords                           []string
            DefaultMergeMessageCommitsLimit          int
            DefaultMergeMessageSize                  int
            DefaultMergeMessageAllAuthors            bool
            DefaultMergeMessageMaxApprovers          int
            DefaultMergeMessageOfficialApproversOnly bool
        }{
            WorkInProgressPrefixes: []string{"WIP:", "[WIP]"},

            CloseKeywords:                            strings.Split("close,closes,closed,fix,fixes,fixed,resolve,resolves,resolved", ","),
            ReopenKeywords:                           strings.Split("reopen,reopens,reopened", ","),
            DefaultMergeMessageCommitsLimit:          50,
            DefaultMergeMessageSize:                  5 * 1024,
            DefaultMergeMessageAllAuthors:            false,
            DefaultMergeMessageMaxApprovers:          10,
            DefaultMergeMessageOfficialApproversOnly: true,
        },

        Issue: struct {
            LockReasons []string
        }{
            LockReasons: strings.Split("Too heated,Off-topic,Spam,Resolved", ","),
        },

        Release: struct {
            AllowedTypes string
        }{
            AllowedTypes: "",
        },

        Signing: struct {
            SigningKey        string
            SigningName       string
            SigningEmail      string
            InitialCommit     []string
            CRUDActions       []string `ini:"CRUD_ACTIONS"`
            Merges            []string
            Wiki              []string
            DefaultTrustModel string
        }{
            SigningKey:        "default",
            SigningName:       "",
            SigningEmail:      "",
            InitialCommit:     []string{"always"},
            CRUDActions:       []string{"pubkey", "twofa", "parentsigned"},
            Merges:            []string{"pubkey", "twofa", "basesigned", "commitssigned"},
            Wiki:              []string{"never"},
            DefaultTrustModel: "collaborator",
        },
    }
    RepoRootPath string
    ScriptType   = "bash"
)

Repository settings

var (
    // AppVer settings
    AppVer         string
    AppBuiltWith   string
    AppStartTime   time.Time
    AppName        string
    AppURL         string
    AppSubURL      string
    AppSubURLDepth int // Number of slashes
    AppPath        string
    AppDataPath    string
    AppWorkPath    string

    // Server settings
    Protocol             Scheme
    Domain               string
    HTTPAddr             string
    HTTPPort             string
    LocalURL             string
    RedirectOtherPort    bool
    PortToRedirect       string
    OfflineMode          bool
    CertFile             string
    KeyFile              string
    StaticRootPath       string
    StaticCacheTime      time.Duration
    EnableGzip           bool
    LandingPageURL       LandingPage
    UnixSocketPermission uint32
    EnablePprof          bool
    PprofDataPath        string
    EnableLetsEncrypt    bool
    LetsEncryptTOS       bool
    LetsEncryptDirectory string
    LetsEncryptEmail     string
    GracefulRestartable  bool
    GracefulHammerTime   time.Duration
    StartupTimeout       time.Duration
    StaticURLPrefix      string
    AbsoluteAssetURL     string

    SSH = struct {
        Disabled                       bool              `ini:"DISABLE_SSH"`
        StartBuiltinServer             bool              `ini:"START_SSH_SERVER"`
        BuiltinServerUser              string            `ini:"BUILTIN_SSH_SERVER_USER"`
        Domain                         string            `ini:"SSH_DOMAIN"`
        Port                           int               `ini:"SSH_PORT"`
        ListenHost                     string            `ini:"SSH_LISTEN_HOST"`
        ListenPort                     int               `ini:"SSH_LISTEN_PORT"`
        RootPath                       string            `ini:"SSH_ROOT_PATH"`
        ServerCiphers                  []string          `ini:"SSH_SERVER_CIPHERS"`
        ServerKeyExchanges             []string          `ini:"SSH_SERVER_KEY_EXCHANGES"`
        ServerMACs                     []string          `ini:"SSH_SERVER_MACS"`
        KeyTestPath                    string            `ini:"SSH_KEY_TEST_PATH"`
        KeygenPath                     string            `ini:"SSH_KEYGEN_PATH"`
        AuthorizedKeysBackup           bool              `ini:"SSH_AUTHORIZED_KEYS_BACKUP"`
        AuthorizedPrincipalsBackup     bool              `ini:"SSH_AUTHORIZED_PRINCIPALS_BACKUP"`
        MinimumKeySizeCheck            bool              `ini:"-"`
        MinimumKeySizes                map[string]int    `ini:"-"`
        CreateAuthorizedKeysFile       bool              `ini:"SSH_CREATE_AUTHORIZED_KEYS_FILE"`
        CreateAuthorizedPrincipalsFile bool              `ini:"SSH_CREATE_AUTHORIZED_PRINCIPALS_FILE"`
        ExposeAnonymous                bool              `ini:"SSH_EXPOSE_ANONYMOUS"`
        AuthorizedPrincipalsAllow      []string          `ini:"SSH_AUTHORIZED_PRINCIPALS_ALLOW"`
        AuthorizedPrincipalsEnabled    bool              `ini:"-"`
        TrustedUserCAKeys              []string          `ini:"SSH_TRUSTED_USER_CA_KEYS"`
        TrustedUserCAKeysFile          string            `ini:"SSH_TRUSTED_USER_CA_KEYS_FILENAME"`
        TrustedUserCAKeysParsed        []gossh.PublicKey `ini:"-"`
    }{
        Disabled:            false,
        StartBuiltinServer:  false,
        Domain:              "",
        Port:                22,
        ServerCiphers:       []string{"aes128-ctr", "aes192-ctr", "aes256-ctr", "aes128-gcm@openssh.com", "arcfour256", "arcfour128"},
        ServerKeyExchanges:  []string{"diffie-hellman-group1-sha1", "diffie-hellman-group14-sha1", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "curve25519-sha256@libssh.org"},
        ServerMACs:          []string{"hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96"},
        KeygenPath:          "ssh-keygen",
        MinimumKeySizeCheck: true,
        MinimumKeySizes:     map[string]int{"ed25519": 256, "ed25519-sk": 256, "ecdsa": 256, "ecdsa-sk": 256, "rsa": 2048},
    }

    // Security settings
    InstallLock                        bool
    SecretKey                          string
    LogInRememberDays                  int
    CookieUserName                     string
    CookieRememberName                 string
    ReverseProxyAuthUser               string
    ReverseProxyAuthEmail              string
    MinPasswordLength                  int
    ImportLocalPaths                   bool
    DisableGitHooks                    bool
    OnlyAllowPushIfGiteaEnvironmentSet bool
    PasswordComplexity                 []string
    PasswordHashAlgo                   string
    PasswordCheckPwn                   bool

    // UI settings
    UI  = struct {
        ExplorePagingNum      int
        IssuePagingNum        int
        RepoSearchPagingNum   int
        MembersPagingNum      int
        FeedMaxCommitNum      int
        FeedPagingNum         int
        GraphMaxCommitNum     int
        CodeCommentLines      int
        ReactionMaxUserNum    int
        ThemeColorMetaTag     string
        MaxDisplayFileSize    int64
        ShowUserEmail         bool
        DefaultShowFullName   bool
        DefaultTheme          string
        Themes                []string
        Reactions             []string
        ReactionsMap          map[string]bool
        SearchRepoDescription bool
        UseServiceWorker      bool

        Notification struct {
            MinTimeout            time.Duration
            TimeoutStep           time.Duration
            MaxTimeout            time.Duration
            EventSourceUpdateTime time.Duration
        }   `ini:"ui.notification"`

        SVG struct {
            Enabled bool `ini:"ENABLE_RENDER"`
        }   `ini:"ui.svg"`

        Admin struct {
            UserPagingNum   int
            RepoPagingNum   int
            NoticePagingNum int
            OrgPagingNum    int
        }   `ini:"ui.admin"`
        User struct {
            RepoPagingNum int
        }   `ini:"ui.user"`
        Meta struct {
            Author      string
            Description string
            Keywords    string
        }   `ini:"ui.meta"`
    }{
        ExplorePagingNum:    20,
        IssuePagingNum:      10,
        RepoSearchPagingNum: 10,
        MembersPagingNum:    20,
        FeedMaxCommitNum:    5,
        FeedPagingNum:       20,
        GraphMaxCommitNum:   100,
        CodeCommentLines:    4,
        ReactionMaxUserNum:  10,
        ThemeColorMetaTag:   `#6cc644`,
        MaxDisplayFileSize:  8388608,
        DefaultTheme:        `gitea`,
        Themes:              []string{`gitea`, `arc-green`},
        Reactions:           []string{`+1`, `-1`, `laugh`, `hooray`, `confused`, `heart`, `rocket`, `eyes`},
        Notification: struct {
            MinTimeout            time.Duration
            TimeoutStep           time.Duration
            MaxTimeout            time.Duration
            EventSourceUpdateTime time.Duration
        }{
            MinTimeout:            10 * time.Second,
            TimeoutStep:           10 * time.Second,
            MaxTimeout:            60 * time.Second,
            EventSourceUpdateTime: 10 * time.Second,
        },
        SVG: struct {
            Enabled bool `ini:"ENABLE_RENDER"`
        }{
            Enabled: true,
        },
        Admin: struct {
            UserPagingNum   int
            RepoPagingNum   int
            NoticePagingNum int
            OrgPagingNum    int
        }{
            UserPagingNum:   50,
            RepoPagingNum:   50,
            NoticePagingNum: 25,
            OrgPagingNum:    50,
        },
        User: struct {
            RepoPagingNum int
        }{
            RepoPagingNum: 15,
        },
        Meta: struct {
            Author      string
            Description string
            Keywords    string
        }{
            Author:      "Gitea - Git with a cup of tea",
            Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
            Keywords:    "go,git,self-hosted,gitea",
        },
    }

    // Markdown settings
    Markdown = struct {
        EnableHardLineBreakInComments  bool
        EnableHardLineBreakInDocuments bool
        CustomURLSchemes               []string `ini:"CUSTOM_URL_SCHEMES"`
        FileExtensions                 []string
    }{
        EnableHardLineBreakInComments:  true,
        EnableHardLineBreakInDocuments: false,
        FileExtensions:                 strings.Split(".md,.markdown,.mdown,.mkd", ","),
    }

    // Admin settings
    Admin struct {
        DisableRegularOrgCreation bool
        DefaultEmailNotification  string
    }

    // Log settings
    LogLevel           string
    StacktraceLogLevel string
    LogRootPath        string
    RedirectMacaronLog bool
    DisableRouterLog   bool
    RouterLogLevel     log.Level
    RouterLogMode      string
    EnableAccessLog    bool
    AccessLogTemplate  string
    EnableXORMLog      bool

    // Time settings
    TimeFormat string
    // UILocation is the location on the UI, so that we can display the time on UI.
    DefaultUILocation = time.Local

    CSRFCookieName     = "_csrf"
    CSRFCookieHTTPOnly = true

    ManifestData string

    // Mirror settings
    Mirror struct {
        DefaultInterval time.Duration
        MinInterval     time.Duration
    }

    // API settings
    API = struct {
        EnableSwagger          bool
        SwaggerURL             string
        MaxResponseItems       int
        DefaultPagingNum       int
        DefaultGitTreesPerPage int
        DefaultMaxBlobSize     int64
    }{
        EnableSwagger:          true,
        SwaggerURL:             "",
        MaxResponseItems:       50,
        DefaultPagingNum:       30,
        DefaultGitTreesPerPage: 1000,
        DefaultMaxBlobSize:     10485760,
    }

    OAuth2 = struct {
        Enable                     bool
        AccessTokenExpirationTime  int64
        RefreshTokenExpirationTime int64
        InvalidateRefreshTokens    bool
        JWTSecretBytes             []byte `ini:"-"`
        JWTSecretBase64            string `ini:"JWT_SECRET"`
        MaxTokenLength             int
    }{
        Enable:                     true,
        AccessTokenExpirationTime:  3600,
        RefreshTokenExpirationTime: 730,
        InvalidateRefreshTokens:    false,
        MaxTokenLength:             math.MaxInt16,
    }

    U2F = struct {
        AppID         string
        TrustedFacets []string
    }{}

    // Metrics settings
    Metrics = struct {
        Enabled bool
        Token   string
    }{
        Enabled: false,
        Token:   "",
    }

    // I18n settings
    Langs []string
    Names []string

    // Other settings
    ShowFooterBranding         bool
    ShowFooterVersion          bool
    ShowFooterTemplateLoadTime bool

    // Global setting objects
    Cfg           *ini.File
    CustomPath    string // Custom directory path
    CustomConf    string
    PIDFile       = "/run/gitea.pid"
    WritePIDFile  bool
    RunMode       string
    RunUser       string
    IsWindows     bool
    HasRobotsTxt  bool
    InternalToken string // internal access token

    // UILocation is the location on the UI, so that we can display the time on UI.
    // Currently only show the default time.Local, it could be added to app.ini after UI is ready
    UILocation = time.Local
)

settings

var (
    // Attachment settings
    Attachment = struct {
        Storage
        AllowedTypes string
        MaxSize      int64
        MaxFiles     int
        Enabled      bool
    }{
        Storage: Storage{
            ServeDirect: false,
        },
        AllowedTypes: "image/jpeg,image/png,application/zip,application/gzip",
        MaxSize:      4,
        MaxFiles:     5,
        Enabled:      true,
    }
)
var (
    // CORSConfig defines CORS settings
    CORSConfig = struct {
        Enabled          bool
        Scheme           string
        AllowDomain      []string
        AllowSubdomain   bool
        Methods          []string
        MaxAge           time.Duration
        AllowCredentials bool
    }{
        Enabled: false,
        MaxAge:  10 * time.Minute,
    }
)
var (
    // CacheService the global cache
    CacheService = struct {
        Cache `ini:"cache"`

        LastCommit struct {
            Enabled      bool
            TTL          time.Duration `ini:"ITEM_TTL"`
            CommitsCount int64
        }   `ini:"cache.last_commit"`
    }{
        Cache: Cache{
            Enabled:  true,
            Adapter:  "memory",
            Interval: 60,
            TTL:      16 * time.Hour,
        },
        LastCommit: struct {
            Enabled      bool
            TTL          time.Duration `ini:"ITEM_TTL"`
            CommitsCount int64
        }{
            Enabled:      true,
            TTL:          8760 * time.Hour,
            CommitsCount: 1000,
        },
    }
)
var (
    // Git settings
    Git = struct {
        Path                      string
        DisableDiffHighlight      bool
        MaxGitDiffLines           int
        MaxGitDiffLineCharacters  int
        MaxGitDiffFiles           int
        CommitsRangeSize          int
        BranchesRangeSize         int
        VerbosePush               bool
        VerbosePushDelay          time.Duration
        GCArgs                    []string `ini:"GC_ARGS" delim:" "`
        EnableAutoGitWireProtocol bool
        PullRequestPushMessage    bool
        Timeout                   struct {
            Default int
            Migrate int
            Mirror  int
            Clone   int
            Pull    int
            GC      int `ini:"GC"`
        }   `ini:"git.timeout"`
    }{
        DisableDiffHighlight:      false,
        MaxGitDiffLines:           1000,
        MaxGitDiffLineCharacters:  5000,
        MaxGitDiffFiles:           100,
        CommitsRangeSize:          50,
        BranchesRangeSize:         20,
        VerbosePush:               true,
        VerbosePushDelay:          5 * time.Second,
        GCArgs:                    []string{},
        EnableAutoGitWireProtocol: true,
        PullRequestPushMessage:    true,
        Timeout: struct {
            Default int
            Migrate int
            Mirror  int
            Clone   int
            Pull    int
            GC      int `ini:"GC"`
        }{
            Default: int(git.DefaultCommandExecutionTimeout / time.Second),
            Migrate: 600,
            Mirror:  300,
            Clone:   300,
            Pull:    300,
            GC:      60,
        },
    }
)
var (
    // Indexer settings
    Indexer = struct {
        IssueType             string
        IssuePath             string
        IssueConnStr          string
        IssueIndexerName      string
        IssueQueueType        string
        IssueQueueDir         string
        IssueQueueConnStr     string
        IssueQueueBatchNumber int
        StartupTimeout        time.Duration

        RepoIndexerEnabled bool
        RepoType           string
        RepoPath           string
        RepoConnStr        string
        RepoIndexerName    string
        UpdateQueueLength  int
        MaxIndexerFileSize int64
        IncludePatterns    []glob.Glob
        ExcludePatterns    []glob.Glob
        ExcludeVendored    bool
    }{
        IssueType:             "bleve",
        IssuePath:             "indexers/issues.bleve",
        IssueConnStr:          "",
        IssueIndexerName:      "gitea_issues",
        IssueQueueType:        LevelQueueType,
        IssueQueueDir:         "indexers/issues.queue",
        IssueQueueConnStr:     "",
        IssueQueueBatchNumber: 20,

        RepoIndexerEnabled: false,
        RepoType:           "bleve",
        RepoPath:           "indexers/repos.bleve",
        RepoConnStr:        "",
        RepoIndexerName:    "gitea_codes",
        MaxIndexerFileSize: 1024 * 1024,
        ExcludeVendored:    true,
    }
)
var LFS = struct {
    StartServer     bool          `ini:"LFS_START_SERVER"`
    JWTSecretBase64 string        `ini:"LFS_JWT_SECRET"`
    JWTSecretBytes  []byte        `ini:"-"`
    HTTPAuthExpiry  time.Duration `ini:"LFS_HTTP_AUTH_EXPIRY"`
    MaxFileSize     int64         `ini:"LFS_MAX_FILE_SIZE"`
    LocksPagingNum  int           `ini:"LFS_LOCKS_PAGING_NUM"`

    Storage
}{}

LFS represents the configuration for Git LFS

var (
    // Migrations settings
    Migrations = struct {
        MaxAttempts        int
        RetryBackoff       int
        AllowedDomains     []string
        BlockedDomains     []string
        AllowLocalNetworks bool
    }{
        MaxAttempts:  3,
        RetryBackoff: 3,
    }
)
var (
    Project = struct {
        ProjectBoardBasicKanbanType []string
        ProjectBoardBugTriageType   []string
    }{
        ProjectBoardBasicKanbanType: []string{"To Do", "In Progress", "Done"},
        ProjectBoardBugTriageType:   []string{"Needs Triage", "High Priority", "Low Priority", "Closed"},
    }
)

Project settings

var Queue = QueueSettings{}

Queue settings

var Service struct {
    DefaultOrgVisibility                    string
    DefaultOrgVisibilityMode                structs.VisibleType
    ActiveCodeLives                         int
    ResetPwdCodeLives                       int
    RegisterEmailConfirm                    bool
    RegisterManualConfirm                   bool
    EmailDomainWhitelist                    []string
    DisableRegistration                     bool
    AllowOnlyExternalRegistration           bool
    ShowRegistrationButton                  bool
    ShowMilestonesDashboardPage             bool
    RequireSignInView                       bool
    EnableNotifyMail                        bool
    EnableBasicAuth                         bool
    EnableReverseProxyAuth                  bool
    EnableReverseProxyAutoRegister          bool
    EnableReverseProxyEmail                 bool
    EnableCaptcha                           bool
    RequireExternalRegistrationCaptcha      bool
    RequireExternalRegistrationPassword     bool
    CaptchaType                             string
    RecaptchaSecret                         string
    RecaptchaSitekey                        string
    RecaptchaURL                            string
    HcaptchaSecret                          string
    HcaptchaSitekey                         string
    DefaultKeepEmailPrivate                 bool
    DefaultAllowCreateOrganization          bool
    EnableTimetracking                      bool
    DefaultEnableTimetracking               bool
    DefaultEnableDependencies               bool
    AllowCrossRepositoryDependencies        bool
    DefaultAllowOnlyContributorsToTrackTime bool
    NoReplyAddress                          string
    EnableUserHeatmap                       bool
    AutoWatchNewRepos                       bool
    AutoWatchOnChanges                      bool
    DefaultOrgMemberVisible                 bool
    UserDeleteWithCommentsMaxTime           time.Duration

    // OpenID settings
    EnableOpenIDSignIn bool
    EnableOpenIDSignUp bool
    OpenIDWhitelist    []*regexp.Regexp
    OpenIDBlacklist    []*regexp.Regexp
}

Service settings

var (
    // SessionConfig difines Session settings
    SessionConfig = struct {
        Provider string
        // Provider configuration, it's corresponding to provider.
        ProviderConfig string
        // Cookie name to save session ID. Default is "MacaronSession".
        CookieName string
        // Cookie path to store. Default is "/".
        CookiePath string
        // GC interval time in seconds. Default is 3600.
        Gclifetime int64
        // Max life time in seconds. Default is whatever GC interval time is.
        Maxlifetime int64
        // Use HTTPS only. Default is false.
        Secure bool
        // Cookie domain name. Default is empty.
        Domain string
    }{
        CookieName:  "i_like_gitea",
        Gclifetime:  86400,
        Maxlifetime: 86400,
    }
)
var (
    // Webhook settings
    Webhook = struct {
        QueueLength    int
        DeliverTimeout int
        SkipTLSVerify  bool
        Types          []string
        PagingNum      int
        ProxyURL       string
        ProxyURLFixed  *url.URL
        ProxyHosts     []string
    }{
        QueueLength:    1000,
        DeliverTimeout: 5,
        SkipTLSVerify:  false,
        PagingNum:      10,
        ProxyURL:       "",
        ProxyHosts:     []string{},
    }
)

func AddLogDescription Uses

func AddLogDescription(key string, description *LogDescription)

AddLogDescription adds a set of descriptions to the complete description

func AddSubLogDescription Uses

func AddSubLogDescription(key string, subLogDescription SubLogDescription) bool

AddSubLogDescription adds a sub log description

func CheckLFSVersion Uses

func CheckLFSVersion()

CheckLFSVersion will check lfs version, if not satisfied, then disable it.

func DBConnStr Uses

func DBConnStr() (string, error)

DBConnStr returns database connection string

func GetCronSettings Uses

func GetCronSettings(name string, config interface{}) (interface{}, error)

GetCronSettings maps the cron subsection to the provided config

func GetDBTypeByName Uses

func GetDBTypeByName(name string) string

GetDBTypeByName returns the database type as it defined on XORM according the given name

func GetLogDescriptions Uses

func GetLogDescriptions() map[string]*LogDescription

GetLogDescriptions returns a race safe set of descriptions

func IndexerGlobFromString Uses

func IndexerGlobFromString(globstr string) []glob.Glob

IndexerGlobFromString parses a comma separated list of patterns and returns a glob.Glob slice suited for repo indexing

func InitDBConfig Uses

func InitDBConfig()

InitDBConfig loads the database settings

func IsProd Uses

func IsProd() bool

IsProd if it's a production mode

func IsRunUserMatchCurrentUser Uses

func IsRunUserMatchCurrentUser(runUser string) (string, bool)

IsRunUserMatchCurrentUser returns false if configured run user does not match actual user that runs the app. The first return value is the actual user name. This check is ignored under Windows since SSH remote login is not the main method to login on Windows.

func MakeAbsoluteAssetURL Uses

func MakeAbsoluteAssetURL(appURL string, staticURLPrefix string) string

MakeAbsoluteAssetURL returns the absolute asset url prefix without a trailing slash

func MakeManifestData Uses

func MakeManifestData(appName string, appURL string, absoluteAssetURL string) []byte

MakeManifestData generates web app manifest JSON

func NewContext Uses

func NewContext()

NewContext initializes configuration context. NOTE: do not print any log except error.

func NewLogServices Uses

func NewLogServices(disableConsole bool)

NewLogServices creates all the log services

func NewQueueService Uses

func NewQueueService()

NewQueueService sets up the default settings for Queues This is exported for tests to be able to use the queue

func NewServices Uses

func NewServices()

NewServices initializes the services

func NewXORMLogService Uses

func NewXORMLogService(disableConsole bool)

NewXORMLogService initializes xorm logger service

func ParseMSSQLHostPort Uses

func ParseMSSQLHostPort(info string) (string, string)

ParseMSSQLHostPort splits the host into host and port

func ParseQueueConnStr Uses

func ParseQueueConnStr(connStr string) (network, addrs, password string, dbIdx int, err error)

ParseQueueConnStr parses a queue connection string

func RemoveSubLogDescription Uses

func RemoveSubLogDescription(key string, name string) bool

RemoveSubLogDescription removes a sub log description

func RestartLogsWithPIDSuffix Uses

func RestartLogsWithPIDSuffix()

RestartLogsWithPIDSuffix restarts the logs with a PID suffix on files

func SetCustomPathAndConf Uses

func SetCustomPathAndConf(providedCustom, providedConf, providedWorkPath string)

SetCustomPathAndConf will set CustomPath and CustomConf with reference to the GITEA_CUSTOM environment variable and with provided overrides before stepping back to the default

type Cache Uses

type Cache struct {
    Enabled  bool
    Adapter  string
    Interval int
    Conn     string
    TTL      time.Duration `ini:"ITEM_TTL"`
}

Cache represents cache settings

type LandingPage Uses

type LandingPage string

LandingPage describes the default page

const (
    LandingPageHome          LandingPage = "/"
    LandingPageExplore       LandingPage = "/explore"
    LandingPageOrganizations LandingPage = "/explore/organizations"
    LandingPageLogin         LandingPage = "/user/login"
)

enumerates all the landing page types

type LogDescription Uses

type LogDescription struct {
    Name               string
    SubLogDescriptions []SubLogDescription
}

LogDescription describes a named logger

type Mailer Uses

type Mailer struct {
    // Mailer
    QueueLength     int
    Name            string
    From            string
    FromName        string
    FromEmail       string
    SendAsPlainText bool
    MailerType      string
    SubjectPrefix   string

    // SMTP sender
    Host              string
    User, Passwd      string
    DisableHelo       bool
    HeloHostname      string
    SkipVerify        bool
    UseCertificate    bool
    CertFile, KeyFile string
    IsTLSEnabled      bool

    // Sendmail sender
    SendmailPath    string
    SendmailArgs    []string
    SendmailTimeout time.Duration
}

Mailer represents mail service.

var (
    // MailService the global mailer
    MailService *Mailer
)

type MarkupParser Uses

type MarkupParser struct {
    Enabled        bool
    MarkupName     string
    Command        string
    FileExtensions []string
    IsInputFile    bool
}

MarkupParser defines the external parser configured in ini

type MarkupSanitizerRule Uses

type MarkupSanitizerRule struct {
    Element   string
    AllowAttr string
    Regexp    *regexp.Regexp
}

MarkupSanitizerRule defines the policy for whitelisting attributes on certain elements.

type QueueSettings Uses

type QueueSettings struct {
    Name             string
    DataDir          string
    QueueLength      int `ini:"LENGTH"`
    BatchLength      int
    ConnectionString string
    Type             string
    Network          string
    Addresses        string
    Password         string
    QueueName        string
    SetName          string
    DBIndex          int
    WrapIfNecessary  bool
    MaxAttempts      int
    Timeout          time.Duration
    Workers          int
    MaxWorkers       int
    BlockTimeout     time.Duration
    BoostTimeout     time.Duration
    BoostWorkers     int
}

QueueSettings represent the settings for a queue from the ini

func GetQueueSettings Uses

func GetQueueSettings(name string) QueueSettings

GetQueueSettings returns the queue settings for the appropriately named queue

type Scheme Uses

type Scheme string

Scheme describes protocol types

const (
    HTTP       Scheme = "http"
    HTTPS      Scheme = "https"
    FCGI       Scheme = "fcgi"
    FCGIUnix   Scheme = "fcgi+unix"
    UnixSocket Scheme = "unix"
)

enumerates all the scheme types

type Storage Uses

type Storage struct {
    Type        string
    Path        string
    Section     *ini.Section
    ServeDirect bool
}

Storage represents configuration of storages

func (*Storage) MapTo Uses

func (s *Storage) MapTo(v interface{}) error

MapTo implements the Mappable interface

type SubLogDescription Uses

type SubLogDescription struct {
    Name     string
    Provider string
    Config   string
}

SubLogDescription describes a sublogger

Package setting imports 34 packages (graph) and is imported by 916 packages. Updated 2021-01-22. Refresh now. Tools for package owners.