feat: add ability to configure application with a config file (#740)

* add config file possibility

* revert port in docker compose

* Update docker-compose.yml

Co-authored-by: Elias Schneider <login@eliasschneider.com>

* Update docker-compose.yml

Co-authored-by: Elias Schneider <login@eliasschneider.com>

* add attribute description to config file

* remove email message config

* add package to resolve errors

* remove email messages from config

* move config initialization to config module

* revert unnecessary change

* add order

* improve alert

* run formatter

* remove unnecessary packages

* remove unnecessary types

* use logger

* don't save yaml config to db

* allowEdit if no yaml config is set

* improve docs

* fix allow edit state

* remove unnecessary check and refactor code

* restore old config file

* add script that generates `config.example.yaml` automatically

* allow config variables to be changed if they are not set in the `config.yml`

* add back init user

* Revert "allow config variables to be changed if they are not set in the `config.yml`"

This reverts commit 7dbdb6729034be5b083f126f854d5e1411735a54.

* improve info box text

---------

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
Mattia Müggler
2025-02-28 11:01:54 +01:00
committed by GitHub
parent f4291421b5
commit 9dfb52a145
21 changed files with 2716 additions and 2077 deletions

View File

@@ -45,6 +45,7 @@ const AdminConfigInput = ({
style={{
width: "100%",
}}
disabled={!configVariable.allowEdit}
{...form.getInputProps("stringValue")}
onChange={(e) => onValueChange(configVariable, e.target.value)}
/>
@@ -53,6 +54,7 @@ const AdminConfigInput = ({
style={{
width: "100%",
}}
disabled={!configVariable.allowEdit}
{...form.getInputProps("stringValue")}
placeholder={configVariable.defaultValue}
onChange={(e) => onValueChange(configVariable, e.target.value)}
@@ -64,6 +66,7 @@ const AdminConfigInput = ({
style={{
width: "100%",
}}
disabled={!configVariable.allowEdit}
autosize
{...form.getInputProps("textValue")}
placeholder={configVariable.defaultValue}
@@ -73,6 +76,7 @@ const AdminConfigInput = ({
{configVariable.type == "number" && (
<NumberInput
{...form.getInputProps("numberValue")}
disabled={!configVariable.allowEdit}
placeholder={configVariable.defaultValue}
onChange={(number) => onValueChange(configVariable, number)}
w={201}
@@ -81,6 +85,7 @@ const AdminConfigInput = ({
{configVariable.type == "filesize" && (
<FileSizeInput
{...form.getInputProps("numberValue")}
disabled={!configVariable.allowEdit}
value={parseInt(configVariable.value ?? configVariable.defaultValue)}
onChange={(bytes) => onValueChange(configVariable, bytes)}
w={201}
@@ -89,6 +94,7 @@ const AdminConfigInput = ({
{configVariable.type == "boolean" && (
<>
<Switch
disabled={!configVariable.allowEdit}
{...form.getInputProps("booleanValue", { type: "checkbox" })}
onChange={(e) => onValueChange(configVariable, e.target.checked)}
/>
@@ -97,6 +103,7 @@ const AdminConfigInput = ({
{configVariable.type == "timespan" && (
<TimespanInput
value={stringToTimespan(configVariable.value)}
disabled={!configVariable.allowEdit}
onChange={(timespan) =>
onValueChange(configVariable, timespanToString(timespan))
}