Merge pull request #2293 from iamEvanYT/vaultwarden-fix

Fix Vaultwarden + Add Configs
This commit is contained in:
Andras Bacsai 2024-05-31 12:44:16 +02:00 committed by GitHub
commit 62334ddef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 67 additions and 2 deletions

View File

@ -42,7 +42,7 @@ public function mount()
$this->validationAttributes["fields.$key.value"] = $fieldKey;
}
}
$this->fields = $this->fields->sortDesc();
//$this->fields = $this->fields->sortDesc();
}
public function saveCompose($raw)
{
@ -52,7 +52,7 @@ public function saveCompose($raw)
public function instantSave()
{
$this->service->save();
$this->dispatch('success', 'Service settings saved.');
$this->dispatch('success', 'Service settings saved.');
}
public function submit()

View File

@ -472,6 +472,63 @@ public function extraFields()
}
$fields->put('Admin', $data->toArray());
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();
$PUSH_ENABLED = $this->environment_variables()->where('key', 'PUSH_ENABLED')->first();
$PUSH_INSTALLATION_ID = $this->environment_variables()->where('key', 'PUSH_SERVICE_ID')->first();
$PUSH_INSTALLATION_KEY = $this->environment_variables()->where('key', 'PUSH_SERVICE_KEY')->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 ($PUSH_ENABLED) {
$data = $data->merge([
'Push Enabled' => [
'key' => data_get($PUSH_ENABLED, 'key'),
'value' => data_get($PUSH_ENABLED, 'value'),
'rules' => 'required|string|in:true,false',
],
]);
}
if ($PUSH_INSTALLATION_ID) {
$data = $data->merge([
'Push Installation ID' => [
'key' => data_get($PUSH_INSTALLATION_ID, 'key'),
'value' => data_get($PUSH_INSTALLATION_ID, 'value'),
],
]);
}
if ($PUSH_INSTALLATION_KEY) {
$data = $data->merge([
'Push Installation Key' => [
'key' => data_get($PUSH_INSTALLATION_KEY, 'key'),
'value' => data_get($PUSH_INSTALLATION_KEY, 'value'),
'isPassword' => true,
],
]);
}
$fields->put('Vaultwarden', $data);
break;
}
}
$databases = $this->databases()->get();

View File

@ -8,6 +8,14 @@ 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}
- IP_HEADER=X-Forwarded-For
- PUSH_ENABLED=${PUSH_ENABLED:-false}
- PUSH_INSTALLATION_ID=${PUSH_SERVICE_ID}
- PUSH_INSTALLATION_KEY=${PUSH_SERVICE_KEY}
volumes:
- vaultwarden-data:/data
healthcheck: