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,205 +27,181 @@
"default": "hedgedoc.example.org" "default": "hedgedoc.example.org"
}, },
"database": { "database": {
"anyOf": [ "nullable": false,
{ "type": "object",
"properties": {
"kind": {
"nullable": false, "nullable": false,
"type": "object", "type": "string",
"properties": { "enum": [
"kind": { "sqlite",
"nullable": false, "postgresql"
"type": "string", ],
"enum": ["sqlite"] "default": "sqlite"
},
"data": {
"nullable": false,
"type": "object",
"properties": {
"path": {
"nullable": false,
"type": "string",
"default": "/var/hedgedoc/data.sqlite"
}
},
"additionalProperties": false,
"required": [
],
"default": {
}
}
},
"additionalProperties": false,
"required": [
"kind"
]
}, },
{ "data": {
"nullable": false, "anyOf": [
"type": "object", {
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["postgresql"]
},
"data": {
"nullable": false, "nullable": false,
"type": "object", "type": "object",
"properties": { "properties": {
"host": { "sqlite": {
"nullable": false, "nullable": false,
"type": "string", "type": "object",
"default": "localhost" "properties": {
}, "path": {
"port": { "nullable": false,
"nullable": false, "type": "string",
"type": "integer", "default": "/var/hedgedoc/data.sqlite"
"default": 5432 }
}, },
"username": { "additionalProperties": false,
"nullable": false, "required": [
"type": "string", ],
"default": "hedgedoc_user" "default": {
}, }
"password": {
"nullable": false,
"type": "string"
},
"schema": {
"nullable": false,
"type": "string",
"default": "hedgedoc"
} }
}, },
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": [
"password" "sqlite"
]
},
{
"nullable": false,
"type": "object",
"properties": {
"postgresql": {
"nullable": false,
"type": "object",
"properties": {
"host": {
"nullable": false,
"type": "string",
"default": "localhost"
},
"port": {
"nullable": false,
"type": "integer",
"default": 5432
},
"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": [
"postgresql"
] ]
} }
},
"additionalProperties": false,
"required": [
"kind",
"data"
]
},
{
"nullable": false,
"type": "object",
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["mariadb"]
},
"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"
] ]
} }
},
"additionalProperties": false,
"required": [
"kind",
"data"
] ]
}, },
"authentication": { "authentication": {
"anyOf": [ "nullable": false,
{ "type": "object",
"properties": {
"kind": {
"nullable": false, "nullable": false,
"type": "object", "type": "string",
"properties": { "enum": [
"kind": { "internal",
"nullable": false, "authelia"
"type": "string", ],
"enum": ["internal"] "default": "internal"
},
"data": {
"nullable": false,
"type": "object",
"properties": {
},
"additionalProperties": false,
"required": [
]
}
},
"additionalProperties": false,
"required": [
"kind"
]
}, },
{ "data": {
"nullable": false, "anyOf": [
"type": "object", {
"properties": {
"kind": {
"nullable": false,
"type": "string",
"enum": ["authelia"]
},
"data": {
"nullable": false, "nullable": false,
"type": "object", "type": "object",
"properties": { "properties": {
"url_base": { "internal": {
"nullable": false, "nullable": false,
"type": "string" "type": "object",
}, "properties": {
"client_id": { },
"nullable": false, "additionalProperties": false,
"type": "string", "required": [
"default": "hedgedoc" ],
}, "default": {
"client_secret": { }
"nullable": false,
"type": "string"
} }
}, },
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": [
"url_base", "internal"
"client_secret" ]
},
{
"nullable": false,
"type": "object",
"properties": {
"authelia": {
"nullable": false,
"type": "object",
"properties": {
"url_base": {
"nullable": false,
"type": "string"
},
"client_id": {
"nullable": false,
"type": "string",
"default": "hedgedoc"
},
"client_secret": {
"nullable": false,
"type": "string"
},
"provider_name": {
"nullable": false,
"type": "string",
"default": "Authelia"
}
},
"additionalProperties": false,
"required": [
"url_base",
"client_secret"
]
}
},
"additionalProperties": false,
"required": [
"authelia"
] ]
} }
},
"additionalProperties": false,
"required": [
"kind"
] ]
} }
},
"additionalProperties": false,
"required": [
"kind",
"data"
] ]
}, },
"log_level": { "log_level": {

View file

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

View file

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

View file

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