This commit is contained in:
Christian Fraß 2025-10-08 12:26:20 +02:00
parent 17df903e14
commit c70362e5ef
4 changed files with 178 additions and 184 deletions

View file

@ -27,17 +27,25 @@
"default": "hedgedoc.example.org"
},
"database": {
"anyOf": [
{
"nullable": false,
"type": "object",
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["sqlite"]
"enum": [
"sqlite",
"postgresql"
],
"default": "sqlite"
},
"data": {
"anyOf": [
{
"nullable": false,
"type": "object",
"properties": {
"sqlite": {
"nullable": false,
"type": "object",
"properties": {
@ -56,19 +64,14 @@
},
"additionalProperties": false,
"required": [
"kind"
"sqlite"
]
},
{
"nullable": false,
"type": "object",
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["postgresql"]
},
"data": {
"postgresql": {
"nullable": false,
"type": "object",
"properties": {
@ -104,99 +107,60 @@
}
},
"additionalProperties": false,
"required": [
"postgresql"
]
}
]
}
},
"additionalProperties": false,
"required": [
"kind",
"data"
]
},
{
"authentication": {
"nullable": false,
"type": "object",
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["mariadb"]
"enum": [
"internal",
"authelia"
],
"default": "internal"
},
"data": {
"nullable": false,
"type": "object",
"properties": {
"host": {
"nullable": false,
"type": "string",
"default": "localhost"
},
"port": {
"nullable": false,
"type": "integer",
"default": 3306
},
"username": {
"nullable": false,
"type": "string",
"default": "hedgedoc_user"
},
"password": {
"nullable": false,
"type": "string"
},
"schema": {
"nullable": false,
"type": "string",
"default": "hedgedoc"
}
},
"additionalProperties": false,
"required": [
"password"
]
}
},
"additionalProperties": false,
"required": [
"kind",
"data"
]
}
]
},
"authentication": {
"anyOf": [
{
"nullable": false,
"type": "object",
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["internal"]
},
"data": {
"internal": {
"nullable": false,
"type": "object",
"properties": {
},
"additionalProperties": false,
"required": [
]
],
"default": {
}
}
},
"additionalProperties": false,
"required": [
"kind"
"internal"
]
},
{
"nullable": false,
"type": "object",
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["authelia"]
},
"data": {
"authelia": {
"nullable": false,
"type": "object",
"properties": {
@ -212,6 +176,11 @@
"client_secret": {
"nullable": false,
"type": "string"
},
"provider_name": {
"nullable": false,
"type": "string",
"default": "Authelia"
}
},
"additionalProperties": false,
@ -223,10 +192,17 @@
},
"additionalProperties": false,
"required": [
"kind"
"authelia"
]
}
]
}
},
"additionalProperties": false,
"required": [
"kind",
"data"
]
},
"log_level": {
"nullable": false,

View file

@ -6,11 +6,29 @@
"database": {
"kind": "sqlite",
"data": {
"sqlite": {
"path": "/var/hedgedoc/data.sqlite"
},
"postgresql": {
"host": "localhost",
"port": 5432,
"username": "hedgedoc_user",
"password": "hedgedoc",
"schema": "hedgedoc"
}
}
},
"authentication": {
"kind": "internal"
"kind": "internal",
"data": {
"internal": {
},
"authelia": {
"client_id": "hedgedoc",
"client_secret": "hedgedoc",
"provider_name": "Authelia"
}
}
},
"log_level": "error",
"guest_allow_create": false,

View file

@ -47,7 +47,7 @@
"become": true,
"ansible.builtin.file": {
"state": "directory",
"path": "{{cfg_hedgedoc.database.data.path | dirname}}",
"path": "{{cfg_hedgedoc.database.data.sqlite.path | dirname}}",
"owner": "{{cfg_hedgedoc.user_name}}"
}
},
@ -56,7 +56,7 @@
"become": true,
"ansible.builtin.file": {
"state": "touch",
"path": "{{cfg_hedgedoc.database.data.path}}",
"path": "{{cfg_hedgedoc.database.sqlite.data.path}}",
"owner": "{{cfg_hedgedoc.user_name}}"
}
}

View file

@ -4,17 +4,17 @@
{% if cfg_hedgedoc.database.kind == 'sqlite' %}
"db": {
"dialect": "sqlite",
"storage": "{{cfg_hedgedoc.database.data.path}}"
"storage": "{{cfg_hedgedoc.database.data.sqlite.path}}"
},
{% endif %}
{% if cfg_hedgedoc.database.kind == 'postgresql' %}
"db": {
"dialect": "postgres",
"host": "{{cfg_hedgedoc.database.data.host}}",
"port": {{cfg_hedgedoc.database.data.port | to_json}},
"username": "{{cfg_hedgedoc.database.data.username}}",
"password": "{{cfg_hedgedoc.database.data.password}}",
"database": "{{cfg_hedgedoc.database.data.schema}}"
"host": "{{cfg_hedgedoc.database.data.postgresql.host}}",
"port": {{cfg_hedgedoc.database.data.postgresql.port | to_json}},
"username": "{{cfg_hedgedoc.database.data.postgresql.username}}",
"password": "{{cfg_hedgedoc.database.data.postgresql.password}}",
"database": "{{cfg_hedgedoc.database.data.postgresql.schema}}"
},
{% endif %}
"sessionSecret": "{{cfg_hedgedoc.session_secret}}",
@ -31,16 +31,16 @@
{% endif %}
{% if cfg_hedgedoc.authentication.kind == 'authelia' %}
"oauth2": {
"providerName": "{{cfg_hedgedoc.authentication.data.provider_name}}",
"clientID": "{{cfg_hedgedoc.authentication.data.client_id}}",
"clientSecret": "{{cfg_hedgedoc.authentication.data.client_secret}}",
"providerName": "{{cfg_hedgedoc.authentication.data.authelia.provider_name}}",
"clientID": "{{cfg_hedgedoc.authentication.data.authelia.client_id}}",
"clientSecret": "{{cfg_hedgedoc.authentication.data.authelia.client_secret}}",
"scope": "openid email profile",
"userProfileUsernameAttr": "sub",
"userProfileDisplayNameAttr": "name",
"userProfileEmailAttr": "email",
"userProfileURL": "{{cfg_hedgedoc.authentication.data.url_base}}/api/oidc/userinfo",
"tokenURL": "{{cfg_hedgedoc.authentication.data.url_base}}/api/oidc/token",
"authorizationURL": "{{cfg_hedgedoc.authentication.data.url_base}}/api/oidc/authorization"
"userProfileURL": "{{cfg_hedgedoc.authentication.data.authelia.url_base}}/api/oidc/userinfo",
"tokenURL": "{{cfg_hedgedoc.authentication.data.authelia.url_base}}/api/oidc/token",
"authorizationURL": "{{cfg_hedgedoc.authentication.data.authelia.url_base}}/api/oidc/authorization"
},
"email": false,
"allowEmailRegister": false,