Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(docs): implement text wrapping for documentation in .env configuration display (#199)

Corentin Thomassetb9c2448805b6
diff --git a/apps/docs/src/config.data.ts b/apps/docs/src/config.data.ts
index 2c8c988a..48696a63 100644
--- a/apps/docs/src/config.data.ts
+++ b/apps/docs/src/config.data.ts
@@ -52,11 +52,32 @@ ${documentation}
`.trim()).join('\n\n---\n\n');
+function wrapText(text: string, maxLength = 75) {
+ const words = text.split(' ');
+ const lines: string[] = [];
+ let currentLine = '';
+
+ words.forEach((word) => {
+ if ((currentLine + word).length + 1 <= maxLength) {
+ currentLine += (currentLine ? ' ' : '') + word;
+ } else {
+ lines.push(currentLine);
+ currentLine = word;
+ }
+ });
+
+ if (currentLine) {
+ lines.push(currentLine);
+ }
+
+ return lines.map(line => `# ${line}`);
+}
+
const fullDotEnv = rows.map(({ env, defaultValue, documentation }) => {
const isEmptyDefaultValue = isNil(defaultValue) || (isArray(defaultValue) && isEmpty(defaultValue)) || defaultValue === '';
return [
- `# ${documentation}`,
+ ...wrapText(documentation),
`# ${env}=${isEmptyDefaultValue ? '' : defaultValue}`,
].join('\n');
}).join('\n\n');
diff --git a/apps/papra-server/src/modules/app/auth/auth.config.ts b/apps/papra-server/src/modules/app/auth/auth.config.ts
index 4ba26078..055689e3 100644
--- a/apps/papra-server/src/modules/app/auth/auth.config.ts
+++ b/apps/papra-server/src/modules/app/auth/auth.config.ts
@@ -38,6 +38,7 @@ export const authConfig = {
isEnabled: {
doc: 'Whether Github OAuth is enabled',
schema: booleanishSchema,
+ default: false,
env: 'AUTH_PROVIDERS_GITHUB_IS_ENABLED',
},
clientId: {