Fix Vaultwarden + Add Configs
This commit is contained in:
parent
b71f1a79c8
commit
7134b46cdc
@ -446,6 +446,102 @@ public function extraFields()
|
||||
|
||||
$fields->put('Ghost', $data);
|
||||
break;
|
||||
case str($image)?->contains('vaultwarden'):
|
||||
$data = collect([]);
|
||||
|
||||
$DATABASE_URL = $this->environment_variables()->where('key', 'DATABASE_URL')->first();
|
||||
$ADMIN_TOKEN = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_64_ADMIN')->first();
|
||||
|
||||
$SMTP_HOST = $this->environment_variables()->where('key', 'SMTP_HOST')->first();
|
||||
$SMTP_FROM_EMAIL = $this->environment_variables()->where('key', 'SMTP_FROM_EMAIL')->first();
|
||||
$SMTP_FROM_NAME = $this->environment_variables()->where('key', 'SMTP_FROM_NAME')->first();
|
||||
$SMTP_USERNAME = $this->environment_variables()->where('key', 'SMTP_USERNAME')->first();
|
||||
$SMTP_PASSWORD = $this->environment_variables()->where('key', 'SMTP_PASS')->first();
|
||||
$SMTP_SECURITY = $this->environment_variables()->where('key', 'SMTP_SECURITY')->first();
|
||||
$SMTP_PORT = $this->environment_variables()->where('key', 'SMTP_PORT')->first();
|
||||
|
||||
if ($DATABASE_URL) {
|
||||
$data = $data->merge([
|
||||
'Database URL' => [
|
||||
'key' => data_get($DATABASE_URL, 'key'),
|
||||
'value' => data_get($DATABASE_URL, 'value'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
if ($ADMIN_TOKEN) {
|
||||
$data = $data->merge([
|
||||
'Admin Password' => [
|
||||
'key' => data_get($ADMIN_TOKEN, 'key'),
|
||||
'value' => data_get($ADMIN_TOKEN, 'value'),
|
||||
'isPassword' => true,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($SMTP_HOST) {
|
||||
$data = $data->merge([
|
||||
'Mail Host' => [
|
||||
'key' => data_get($SMTP_HOST, 'key'),
|
||||
'value' => data_get($SMTP_HOST, 'value'),
|
||||
'rules' => 'nullable|url',
|
||||
],
|
||||
]);
|
||||
}
|
||||
if ($SMTP_FROM_EMAIL) {
|
||||
$data = $data->merge([
|
||||
'From Email' => [
|
||||
'key' => data_get($SMTP_FROM_EMAIL, 'key'),
|
||||
'value' => data_get($SMTP_FROM_EMAIL, 'value'),
|
||||
'rules' => 'nullable|email',
|
||||
],
|
||||
]);
|
||||
}
|
||||
if ($SMTP_FROM_NAME) {
|
||||
$data = $data->merge([
|
||||
'From Name' => [
|
||||
'key' => data_get($SMTP_FROM_NAME, 'key'),
|
||||
'value' => data_get($SMTP_FROM_NAME, 'value'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
if ($SMTP_USERNAME) {
|
||||
$data = $data->merge([
|
||||
'Mail User' => [
|
||||
'key' => data_get($SMTP_USERNAME, 'key'),
|
||||
'value' => data_get($SMTP_USERNAME, 'value'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
if ($SMTP_PASSWORD) {
|
||||
$data = $data->merge([
|
||||
'Maill Password' => [
|
||||
'key' => data_get($SMTP_PASSWORD, 'key'),
|
||||
'value' => data_get($SMTP_PASSWORD, 'value'),
|
||||
'isPassword' => true,
|
||||
],
|
||||
]);
|
||||
}
|
||||
if ($SMTP_SECURITY) {
|
||||
$data = $data->merge([
|
||||
'Mail Security' => [
|
||||
'key' => data_get($SMTP_SECURITY, 'key'),
|
||||
'value' => data_get($SMTP_SECURITY, 'value'),
|
||||
'rules' => 'nullable|string|in:starttls,force_tls,off',
|
||||
],
|
||||
]);
|
||||
}
|
||||
if ($SMTP_PORT) {
|
||||
$data = $data->merge([
|
||||
'Mail Port' => [
|
||||
'key' => data_get($SMTP_PORT, 'key'),
|
||||
'value' => data_get($SMTP_PORT, 'value'),
|
||||
'rules' => 'nullable|integer',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$fields->put('Vaultwarden', $data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$databases = $this->databases()->get();
|
||||
|
@ -8,6 +8,18 @@ services:
|
||||
image: vaultwarden/server:latest
|
||||
environment:
|
||||
- SERVICE_FQDN_VAULTWARDEN
|
||||
- DOMAIN=${SERVICE_FQDN_VAULTWARDEN}
|
||||
- DATABASE_URL=${VAULTWARDEN_DB_URL:-data/db.sqlite3}
|
||||
- SIGNUPS_ALLOWED=${SIGNUP_ALLOWED:-true}
|
||||
- ADMIN_TOKEN=${SERVICE_PASSWORD_64_ADMIN}
|
||||
- SMTP_HOST=${SMTP_HOST}
|
||||
- SMTP_FROM=${SMTP_FROM_EMAIL}
|
||||
- SMTP_FROM_NAME=${SMTP_FROM_NAME:-Vaultwarden}
|
||||
- SMTP_USERNAME=${SMTP_USER}
|
||||
- SMTP_PASSWORD=${SMTP_PASS}
|
||||
- SMTP_SECURITY=${SMTP_SECURITY:-starttls}
|
||||
- SMTP_PORT=${SMTP_PORT}
|
||||
- SMTP_TIMEOUT=15
|
||||
volumes:
|
||||
- vaultwarden-data:/data
|
||||
healthcheck:
|
||||
|
Loading…
Reference in New Issue
Block a user