mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
feat(config): warn user about not yet supported config
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
d43da06ec1
commit
5335c48df7
4 changed files with 53 additions and 3 deletions
|
@ -221,15 +221,30 @@ export default registerAs('authConfig', () => {
|
||||||
const gitlabNames = (
|
const gitlabNames = (
|
||||||
toArrayConfig(process.env.HD_AUTH_GITLABS, ',') ?? []
|
toArrayConfig(process.env.HD_AUTH_GITLABS, ',') ?? []
|
||||||
).map((name) => name.toUpperCase());
|
).map((name) => name.toUpperCase());
|
||||||
|
if (gitlabNames.length !== 0) {
|
||||||
|
throw new Error(
|
||||||
|
"GitLab auth is currently not yet supported. Please don't configure it",
|
||||||
|
);
|
||||||
|
}
|
||||||
const ldapNames = (
|
const ldapNames = (
|
||||||
toArrayConfig(process.env.HD_AUTH_LDAP_SERVERS, ',') ?? []
|
toArrayConfig(process.env.HD_AUTH_LDAP_SERVERS, ',') ?? []
|
||||||
).map((name) => name.toUpperCase());
|
).map((name) => name.toUpperCase());
|
||||||
const samlNames = (toArrayConfig(process.env.HD_AUTH_SAMLS, ',') ?? []).map(
|
const samlNames = (toArrayConfig(process.env.HD_AUTH_SAMLS, ',') ?? []).map(
|
||||||
(name) => name.toUpperCase(),
|
(name) => name.toUpperCase(),
|
||||||
);
|
);
|
||||||
|
if (samlNames.length !== 0) {
|
||||||
|
throw new Error(
|
||||||
|
"SAML auth is currently not yet supported. Please don't configure it",
|
||||||
|
);
|
||||||
|
}
|
||||||
const oauth2Names = (
|
const oauth2Names = (
|
||||||
toArrayConfig(process.env.HD_AUTH_OAUTH2S, ',') ?? []
|
toArrayConfig(process.env.HD_AUTH_OAUTH2S, ',') ?? []
|
||||||
).map((name) => name.toUpperCase());
|
).map((name) => name.toUpperCase());
|
||||||
|
if (oauth2Names.length !== 0) {
|
||||||
|
throw new Error(
|
||||||
|
"OAuth2 auth is currently not yet supported. Please don't configure it",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const gitlabs = gitlabNames.map((gitlabName) => {
|
const gitlabs = gitlabNames.map((gitlabName) => {
|
||||||
return {
|
return {
|
||||||
|
@ -334,6 +349,25 @@ export default registerAs('authConfig', () => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (
|
||||||
|
process.env.HD_AUTH_GITHUB_CLIENT_ID !== undefined ||
|
||||||
|
process.env.HD_AUTH_GITHUB_CLIENT_SECRET !== undefined
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"GitHub config is currently not yet supported. Please don't configure it",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
process.env.HD_AUTH_GOOGLE_CLIENT_ID !== undefined ||
|
||||||
|
process.env.HD_AUTH_GOOGLE_CLIENT_SECRET !== undefined ||
|
||||||
|
process.env.HD_AUTH_GOOGLE_APP_KEY !== undefined
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"Google config is currently not yet supported. Please don't configure it",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const authConfig = authSchema.validate(
|
const authConfig = authSchema.validate(
|
||||||
{
|
{
|
||||||
session: {
|
session: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -19,6 +19,15 @@ const cspSchema = Joi.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
export default registerAs('cspConfig', () => {
|
export default registerAs('cspConfig', () => {
|
||||||
|
if (
|
||||||
|
process.env.HD_CSP_ENABLE !== undefined ||
|
||||||
|
process.env.HD_CSP_REPORT_URI !== undefined
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"CSP config is currently not yet supported. Please don't configure it",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const cspConfig = cspSchema.validate(
|
const cspConfig = cspSchema.validate(
|
||||||
{
|
{
|
||||||
enable: process.env.HD_CSP_ENABLE || true,
|
enable: process.env.HD_CSP_ENABLE || true,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -29,6 +29,11 @@ const schema = Joi.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
export default registerAs('externalServicesConfig', () => {
|
export default registerAs('externalServicesConfig', () => {
|
||||||
|
if (process.env.HD_IMAGE_PROXY !== undefined) {
|
||||||
|
throw new Error(
|
||||||
|
"HD_IMAGE_PROXY is currently not yet supported. Please don't configure it",
|
||||||
|
);
|
||||||
|
}
|
||||||
const externalConfig = schema.validate(
|
const externalConfig = schema.validate(
|
||||||
{
|
{
|
||||||
plantUmlServer: process.env.HD_PLANTUML_SERVER,
|
plantUmlServer: process.env.HD_PLANTUML_SERVER,
|
||||||
|
|
|
@ -3,4 +3,6 @@
|
||||||
| environment variable | default | example | description |
|
| environment variable | default | example | description |
|
||||||
|------------------------|---------|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
|
|------------------------|---------|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `HD_PLANTUML_SERVER` | - | `https://www.plantuml.com/plantuml` | The PlantUML server that HedgeDoc uses to render PlantUML diagrams. If this is not configured, PlantUML diagrams won't be rendered. |
|
| `HD_PLANTUML_SERVER` | - | `https://www.plantuml.com/plantuml` | The PlantUML server that HedgeDoc uses to render PlantUML diagrams. If this is not configured, PlantUML diagrams won't be rendered. |
|
||||||
| `HD_IMAGE_PROXY` | - | `https://image-proxy.example.com` | **ToDo:** Add description |
|
<!--
|
||||||
|
| `HD_IMAGE_PROXY` | - | `https://image-proxy.example.com` | **ToDo:** Add description |
|
||||||
|
-->
|
Loading…
Reference in a new issue