38
38
} ;
39
39
authEnabled = mkOption {
40
40
type = types . bool ;
41
- default = false ;
41
+ default = true ;
42
42
description = "Enables authentication in SourceBot" ;
43
43
} ;
44
44
telemetryDisabled = mkOption {
76
76
default = 16379 ;
77
77
description = "TCP port for the SourceBot Redis server to listen on" ;
78
78
} ;
79
+ databaseUrl = mkOption {
80
+ type = types . nullOr types . str ;
81
+ default = "postgresql://sourcebot@localhost:${ toString config . services . postgresql . settings . port } /sourcebot" ;
82
+ description = "PostgreSQL connection URL for SourceBot. If not set, a local PostgreSQL server will be configured and used." ;
83
+ } ;
79
84
} ;
80
85
81
86
config = mkIf cfg . enable {
155
160
Group = "sourcebot" ;
156
161
ExecStart = "${ pkgs . prisma } /bin/prisma migrate deploy --schema ${ cfg . package } /packages/db/prisma/schema.prisma" ;
157
162
Environment = [
158
- "DATABASE_URL=postgresql://sourcebot@localhost:${ toString config . services . postgresql . settings . port } /sourcebot"
159
163
"PATH=${ makeBinPath ( with pkgs ; [ prisma openssl ] ) } "
164
+ "DATABASE_URL=${ cfg . databaseUrl } "
160
165
] ;
161
166
Restart = "on-failure" ;
162
167
RestartSec = "5s" ;
@@ -178,15 +183,15 @@ in {
178
183
"DATA_CACHE_DIR=${ cfg . dataCacheDir } "
179
184
"PORT=${ toString cfg . port } "
180
185
"HOSTNAME=${ cfg . hostname } "
181
- "DATABASE_URL=postgresql://sourcebot@localhost: ${ toString config . services . postgresql . settings . port } /sourcebot "
186
+ "DATABASE_URL=${ cfg . databaseUrl } "
182
187
"REDIS_URL=redis://localhost:${ toString cfg . redisPort } "
183
188
"CONFIG_PATH=${ cfg . configPath } "
184
189
"SOURCEBOT_LOG_LEVEL=${ cfg . logLevel } "
185
190
"SOURCEBOT_TENANCY_MODE=single"
186
- "SOURCEBOT_AUTH_ENABLED =${ boolToString cfg . authEnabled } "
191
+ "AUTH_CREDENTIALS_LOGIN_ENABLED =${ boolToString cfg . authEnabled } "
187
192
"SOURCEBOT_TELEMETRY_DISABLED=${ boolToString cfg . telemetryDisabled } "
188
193
"SOURCEBOT_PUBLIC_KEY_PATH=${ cfg . package } /public.pem"
189
- "AUTH_URL=${ cfg . authUrl } "
194
+ "AUTH_URL=http:// ${ cfg . hostname } : ${ toString cfg . port } "
190
195
]
191
196
++ optional ( cfg . envFile == null ) [
192
197
"AUTH_SECRET=00000000000000000000000000000000000000000000"
217
222
"CONFIG_PATH=${ cfg . configPath } "
218
223
"SOURCEBOT_LOG_LEVEL=${ cfg . logLevel } "
219
224
"SOURCEBOT_TENANCY_MODE=single"
220
- "SOURCEBOT_AUTH_ENABLED =${ boolToString cfg . authEnabled } "
225
+ "AUTH_CREDENTIALS_LOGIN_ENABLED =${ boolToString cfg . authEnabled } "
221
226
"SOURCEBOT_TELEMETRY_DISABLED=${ boolToString cfg . telemetryDisabled } "
222
227
"SOURCEBOT_PUBLIC_KEY_PATH=${ cfg . package } /public.pem"
223
228
"AUTH_URL=http://${ cfg . hostname } :${ toString cfg . port } "
0 commit comments