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:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
Alert,
|
||||
AppShell,
|
||||
Box,
|
||||
Button,
|
||||
@@ -13,6 +14,7 @@ import { useMediaQuery } from "@mantine/hooks";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { TbInfoCircle } from "react-icons/tb";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import Meta from "../../../components/Meta";
|
||||
import AdminConfigInput from "../../../components/admin/configuration/AdminConfigInput";
|
||||
@@ -46,6 +48,10 @@ export default function AppShellDemo() {
|
||||
|
||||
const [logo, setLogo] = useState<File | null>(null);
|
||||
|
||||
const isEditingAllowed = (): boolean => {
|
||||
return !configVariables || configVariables[0].allowEdit;
|
||||
};
|
||||
|
||||
const saveConfigVariables = async () => {
|
||||
if (logo) {
|
||||
configService
|
||||
@@ -132,6 +138,17 @@ export default function AppShellDemo() {
|
||||
) : (
|
||||
<>
|
||||
<Stack>
|
||||
{!isEditingAllowed() && (
|
||||
<Alert
|
||||
mb={"lg"}
|
||||
variant="light"
|
||||
color="primary"
|
||||
title={t("admin.config.config-file-warning.title")}
|
||||
icon={<TbInfoCircle />}
|
||||
>
|
||||
<FormattedMessage id="admin.config.config-file-warning.description" />
|
||||
</Alert>
|
||||
)}
|
||||
<Title mb="md" order={3}>
|
||||
{t("admin.config.category." + categoryId)}
|
||||
</Title>
|
||||
|
||||
Reference in New Issue
Block a user