defaults.go (6097B)
1 // GoToSocial 2 // Copyright (C) GoToSocial Authors admin@gotosocial.org 3 // SPDX-License-Identifier: AGPL-3.0-or-later 4 // 5 // This program is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Affero General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Affero General Public License for more details. 14 // 15 // You should have received a copy of the GNU Affero General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 package config 19 20 import ( 21 "time" 22 23 "codeberg.org/gruf/go-bytesize" 24 "github.com/coreos/go-oidc/v3/oidc" 25 ) 26 27 // Defaults contains a populated Configuration with reasonable defaults. Note that 28 // if you use this, you will still need to set Host, and, if desired, ConfigPath. 29 var Defaults = Configuration{ 30 LogLevel: "info", 31 LogDbQueries: false, 32 ApplicationName: "gotosocial", 33 LandingPageUser: "", 34 ConfigPath: "", 35 Host: "", 36 AccountDomain: "", 37 Protocol: "https", 38 BindAddress: "0.0.0.0", 39 Port: 8080, 40 TrustedProxies: []string{"127.0.0.1/32", "::1"}, // localhost 41 42 DbType: "postgres", 43 DbAddress: "", 44 DbPort: 5432, 45 DbUser: "", 46 DbPassword: "", 47 DbDatabase: "gotosocial", 48 DbTLSMode: "disable", 49 DbTLSCACert: "", 50 DbMaxOpenConnsMultiplier: 8, 51 DbSqliteJournalMode: "WAL", 52 DbSqliteSynchronous: "NORMAL", 53 DbSqliteCacheSize: 8 * bytesize.MiB, 54 DbSqliteBusyTimeout: time.Minute * 30, 55 56 WebTemplateBaseDir: "./web/template/", 57 WebAssetBaseDir: "./web/assets/", 58 59 InstanceExposePeers: false, 60 InstanceExposeSuspended: false, 61 InstanceExposeSuspendedWeb: false, 62 InstanceDeliverToSharedInboxes: true, 63 64 AccountsRegistrationOpen: true, 65 AccountsApprovalRequired: true, 66 AccountsReasonRequired: true, 67 AccountsAllowCustomCSS: false, 68 AccountsCustomCSSLength: 10000, 69 70 MediaImageMaxSize: 10 * bytesize.MiB, 71 MediaVideoMaxSize: 40 * bytesize.MiB, 72 MediaDescriptionMinChars: 0, 73 MediaDescriptionMaxChars: 500, 74 MediaRemoteCacheDays: 30, 75 MediaEmojiLocalMaxSize: 50 * bytesize.KiB, 76 MediaEmojiRemoteMaxSize: 100 * bytesize.KiB, 77 78 StorageBackend: "local", 79 StorageLocalBasePath: "/gotosocial/storage", 80 StorageS3UseSSL: true, 81 StorageS3Proxy: false, 82 83 StatusesMaxChars: 5000, 84 StatusesCWMaxChars: 100, 85 StatusesPollMaxOptions: 6, 86 StatusesPollOptionMaxChars: 50, 87 StatusesMediaMaxFiles: 6, 88 89 LetsEncryptEnabled: false, 90 LetsEncryptPort: 80, 91 LetsEncryptCertDir: "/gotosocial/storage/certs", 92 LetsEncryptEmailAddress: "", 93 94 TLSCertificateChain: "", 95 TLSCertificateKey: "", 96 97 OIDCEnabled: false, 98 OIDCIdpName: "", 99 OIDCSkipVerification: false, 100 OIDCIssuer: "", 101 OIDCClientID: "", 102 OIDCClientSecret: "", 103 OIDCScopes: []string{oidc.ScopeOpenID, "profile", "email", "groups"}, 104 OIDCLinkExisting: false, 105 106 SMTPHost: "", 107 SMTPPort: 0, 108 SMTPUsername: "", 109 SMTPPassword: "", 110 SMTPFrom: "GoToSocial", 111 SMTPDiscloseRecipients: false, 112 113 TracingEnabled: false, 114 TracingTransport: "grpc", 115 TracingEndpoint: "", 116 TracingInsecureTransport: false, 117 118 SyslogEnabled: false, 119 SyslogProtocol: "udp", 120 SyslogAddress: "localhost:514", 121 122 AdvancedCookiesSamesite: "lax", 123 AdvancedRateLimitRequests: 300, // 1 per second per 5 minutes 124 AdvancedThrottlingMultiplier: 8, // 8 open requests per CPU 125 AdvancedSenderMultiplier: 2, // 2 senders per CPU 126 127 Cache: CacheConfiguration{ 128 GTS: GTSCacheConfiguration{ 129 AccountMaxSize: 2000, 130 AccountTTL: time.Minute * 30, 131 AccountSweepFreq: time.Minute, 132 133 BlockMaxSize: 1000, 134 BlockTTL: time.Minute * 30, 135 BlockSweepFreq: time.Minute, 136 137 DomainBlockMaxSize: 2000, 138 DomainBlockTTL: time.Hour * 24, 139 DomainBlockSweepFreq: time.Minute, 140 141 EmojiMaxSize: 2000, 142 EmojiTTL: time.Minute * 30, 143 EmojiSweepFreq: time.Minute, 144 145 EmojiCategoryMaxSize: 100, 146 EmojiCategoryTTL: time.Minute * 30, 147 EmojiCategorySweepFreq: time.Minute, 148 149 FollowMaxSize: 2000, 150 FollowTTL: time.Minute * 30, 151 FollowSweepFreq: time.Minute, 152 153 FollowRequestMaxSize: 2000, 154 FollowRequestTTL: time.Minute * 30, 155 FollowRequestSweepFreq: time.Minute, 156 157 ListMaxSize: 2000, 158 ListTTL: time.Minute * 30, 159 ListSweepFreq: time.Minute, 160 161 ListEntryMaxSize: 2000, 162 ListEntryTTL: time.Minute * 30, 163 ListEntrySweepFreq: time.Minute, 164 165 MediaMaxSize: 1000, 166 MediaTTL: time.Minute * 30, 167 MediaSweepFreq: time.Minute, 168 169 MentionMaxSize: 2000, 170 MentionTTL: time.Minute * 30, 171 MentionSweepFreq: time.Minute, 172 173 NotificationMaxSize: 1000, 174 NotificationTTL: time.Minute * 30, 175 NotificationSweepFreq: time.Minute, 176 177 ReportMaxSize: 100, 178 ReportTTL: time.Minute * 30, 179 ReportSweepFreq: time.Minute, 180 181 StatusMaxSize: 2000, 182 StatusTTL: time.Minute * 30, 183 StatusSweepFreq: time.Minute, 184 185 StatusFaveMaxSize: 2000, 186 StatusFaveTTL: time.Minute * 30, 187 StatusFaveSweepFreq: time.Minute, 188 189 TombstoneMaxSize: 500, 190 TombstoneTTL: time.Minute * 30, 191 TombstoneSweepFreq: time.Minute, 192 193 UserMaxSize: 500, 194 UserTTL: time.Minute * 30, 195 UserSweepFreq: time.Minute, 196 197 WebfingerMaxSize: 250, 198 WebfingerTTL: time.Hour * 24, 199 WebfingerSweepFreq: time.Minute * 15, 200 }, 201 202 VisibilityMaxSize: 2000, 203 VisibilityTTL: time.Minute * 30, 204 VisibilitySweepFreq: time.Minute, 205 }, 206 207 AdminMediaPruneDryRun: true, 208 209 RequestIDHeader: "X-Request-Id", 210 211 LogClientIP: true, 212 }