@@ -7,14 +7,35 @@ import (
7
7
)
8
8
9
9
const (
10
- DatabaseTypeKey = "database.type"
11
- DefaultDatabaseType = "local"
10
+ DatabaseTypeKey = "database.type"
11
+ LocalDatabaseType = "local"
12
12
13
- DatabaseKVLocalPath = "database.local.path"
14
- DefaultDatabaseLocalKVPath = "~/lakefs/metadata"
13
+ DatabaseLocalPathKey = "database.local.path"
14
+ DefaultDatabaseLocalPath = "~/lakefs/metadata"
15
15
16
- BlockstoreTypeKey = "blockstore.type"
17
- DefaultBlockstoreType = "local"
16
+ DatabaseLocalPrefetchSizeKey = "database.local.prefetch_size"
17
+ DefaultDatabaseLocalPrefetchSize = 256
18
+
19
+ DatabaseDynamodbTableNameKey = "database.dynamodb.table_name"
20
+ DefaultDatabaseDynamodbTableName = "kvstore"
21
+
22
+ DatabaseDynamodbReadCapacityUnitsKey = "database.dynamodb.read_capacity_units"
23
+ DefaultDatabaseDynamodbReadCapacityUnits = 1000
24
+
25
+ DatabaseDynamodbWriteCapacityUnitsKey = "database.dynamodb.write_capacity_units"
26
+ DefaultDatabaseDynamodbWriteCapacityUnits = 1000
27
+
28
+ DatabasePostgresMaxOpenConnectionsKey = "database.postgres.max_open_connections"
29
+ DefaultDatabasePostgresMaxOpenConnections = 25
30
+
31
+ DatabasePostgresMaxIdleConnectionsKey = "database.postgres.max_idle_connections"
32
+ DefaultDatabasePostgresMaxIdleConnections = 25
33
+
34
+ PostgresConnectionMaxLifetimeKey = "database.postgres.connection_max_lifetime"
35
+ DefaultPostgresConnectionMaxLifetime = "5m"
36
+
37
+ BlockstoreTypeKey = "blockstore.type"
38
+ LocalBlockstoreType = "local"
18
39
19
40
BlockstoreLocalPathKey = "blockstore.local.path"
20
41
DefaultBlockstoreLocalPath = "~/lakefs/data/block"
@@ -88,8 +109,8 @@ const (
88
109
LoggingFilesKeepKey = "logging.files_keep"
89
110
LoggingAuditLogLevel = "logging.audit_log_level"
90
111
91
- AuthEncryptSecretKey = "auth.encrypt.secret_key" // #nosec
92
- DefaultAuthEncryptSecretKey = "THIS_MUST_BE_CHANGED_IN_PRODUCTION" // #nosec
112
+ AuthEncryptSecretKey = "auth.encrypt.secret_key" // #nosec
113
+ LocalAuthEncryptSecretKey = "THIS_MUST_BE_CHANGED_IN_PRODUCTION" // #nosec
93
114
94
115
ActionsEnabledKey = "actions.enabled"
95
116
@@ -134,17 +155,11 @@ const (
134
155
UIEnabledKey = "ui.enabled"
135
156
)
136
157
137
- func setDefaultLocalConfig () {
138
- viper .SetDefault (DatabaseTypeKey , DefaultDatabaseType )
139
- viper .SetDefault (DatabaseKVLocalPath , DefaultDatabaseLocalKVPath )
140
- viper .SetDefault (BlockstoreLocalPathKey , DefaultBlockstoreLocalPath )
141
- viper .SetDefault (AuthEncryptSecretKey , DefaultAuthEncryptSecretKey )
142
- viper .SetDefault (BlockstoreTypeKey , DefaultBlockstoreType )
143
- }
144
-
145
158
func setDefaults (local bool ) {
146
159
if local {
147
- setDefaultLocalConfig ()
160
+ viper .SetDefault (DatabaseTypeKey , LocalDatabaseType )
161
+ viper .SetDefault (AuthEncryptSecretKey , LocalAuthEncryptSecretKey )
162
+ viper .SetDefault (BlockstoreTypeKey , LocalBlockstoreType )
148
163
}
149
164
150
165
viper .SetDefault (ListenAddressKey , DefaultListenAddr )
@@ -166,7 +181,6 @@ func setDefaults(local bool) {
166
181
viper .SetDefault (AuthLogoutRedirectURL , DefaultAuthLogoutRedirectURL )
167
182
168
183
viper .SetDefault (BlockstoreLocalPathKey , DefaultBlockstoreLocalPath )
169
- viper .SetDefault (BlockstoreTypeKey , DefaultBlockstoreType )
170
184
viper .SetDefault (BlockstoreS3RegionKey , DefaultBlockstoreS3Region )
171
185
viper .SetDefault (BlockstoreS3StreamingChunkSizeKey , DefaultBlockstoreS3StreamingChunkSize )
172
186
viper .SetDefault (BlockstoreS3StreamingChunkTimeoutKey , DefaultBlockstoreS3StreamingChunkTimeout )
@@ -206,4 +220,18 @@ func setDefaults(local bool) {
206
220
viper .SetDefault (LakefsEmailBaseURLKey , DefaultLakefsEmailBaseURL )
207
221
208
222
viper .SetDefault (UIEnabledKey , DefaultUIEnabled )
223
+
224
+ viper .SetDefault (BlockstoreLocalPathKey , DefaultBlockstoreLocalPath )
225
+
226
+ viper .SetDefault (DatabaseLocalPathKey , DefaultDatabaseLocalPath )
227
+ viper .SetDefault (DatabaseLocalPrefetchSizeKey , DefaultDatabaseLocalPrefetchSize )
228
+
229
+ viper .SetDefault (DatabaseDynamodbTableNameKey , DefaultDatabaseDynamodbTableName )
230
+
231
+ viper .SetDefault (DatabaseDynamodbReadCapacityUnitsKey , DefaultDatabaseDynamodbReadCapacityUnits )
232
+ viper .SetDefault (DatabaseDynamodbWriteCapacityUnitsKey , DefaultDatabaseDynamodbWriteCapacityUnits )
233
+
234
+ viper .SetDefault (DatabasePostgresMaxOpenConnectionsKey , DefaultDatabasePostgresMaxOpenConnections )
235
+ viper .SetDefault (DatabasePostgresMaxIdleConnectionsKey , DefaultDatabasePostgresMaxIdleConnections )
236
+ viper .SetDefault (PostgresConnectionMaxLifetimeKey , DefaultPostgresConnectionMaxLifetime )
209
237
}
0 commit comments