mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-20 03:32:35 +02:00
add v2 migration configuration docs.
This commit is contained in:
parent
4d0aea6040
commit
33580fe440
9 changed files with 613 additions and 63 deletions
|
@ -366,9 +366,10 @@ Shortcut environment variable to enable DEBUG mode: `NEKO_DEBUG=true`
|
|||
|
||||
Here is a full configuration with default values as shown in the help command. Please refer to the sub-sections for more details.
|
||||
|
||||
import Configuration from './help.tsx'
|
||||
import Configuration from '@site/src/components/Configuration';
|
||||
import configOptions from './help.json';
|
||||
|
||||
<Configuration />
|
||||
<Configuration configOptions={configOptions} />
|
||||
|
||||
## Next Steps
|
||||
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
/* This script reads the help.txt file and generates a help.json file with the configuration options. */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const parseConfigOptions = (text) => {
|
||||
const lines = text.split('\n');
|
||||
return lines.map(line => {
|
||||
const match = line.match(/--([\w.]+)(?:\s(\w+))?\s+(.*?)(?:\s+\(default\s+"?([^"]+)"?\))?$/);
|
||||
if (match) {
|
||||
let [, key, type, description, defaultValue] = match;
|
||||
// if the type is not specified, it is a boolean
|
||||
if (!type) {
|
||||
type = 'boolean';
|
||||
// if the default value is not specified, it is false
|
||||
if (defaultValue !== 'false') {
|
||||
defaultValue = 'true';
|
||||
}
|
||||
}
|
||||
return { key: key.split('.'), type, defaultValue: defaultValue || undefined, description };
|
||||
}
|
||||
return null;
|
||||
}).filter(option => option !== null);
|
||||
};
|
||||
|
||||
const filePath = path.resolve(__dirname, 'help.txt');
|
||||
const outputFilePath = path.resolve(__dirname, 'help.json');
|
||||
|
||||
fs.readFile(filePath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading help file:', err);
|
||||
return;
|
||||
}
|
||||
const configOptions = parseConfigOptions(data);
|
||||
fs.writeFile(outputFilePath, JSON.stringify(configOptions, null, 2), (err) => {
|
||||
if (err) {
|
||||
console.error('Error writing help file:', err);
|
||||
} else {
|
||||
console.log('Help file generated successfully.');
|
||||
}
|
||||
});
|
||||
});
|
|
@ -113,7 +113,7 @@
|
|||
"enabled"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "enable screencast"
|
||||
},
|
||||
{
|
||||
|
@ -200,7 +200,7 @@
|
|||
"enabled"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "enable webcam stream"
|
||||
},
|
||||
{
|
||||
|
@ -237,7 +237,7 @@
|
|||
"file_chooser_dialog"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "whether to handle file chooser dialog externally"
|
||||
},
|
||||
{
|
||||
|
@ -380,7 +380,7 @@
|
|||
"enabled"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "load plugins in runtime"
|
||||
},
|
||||
{
|
||||
|
@ -389,7 +389,7 @@
|
|||
"required"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "if true, neko will exit if there is an error when loading a plugin"
|
||||
},
|
||||
{
|
||||
|
@ -449,7 +449,7 @@
|
|||
"pprof"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "enable pprof endpoint available at /debug/pprof"
|
||||
},
|
||||
{
|
||||
|
@ -458,7 +458,7 @@
|
|||
"proxy"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "trust reverse proxy headers"
|
||||
},
|
||||
{
|
||||
|
@ -483,7 +483,7 @@
|
|||
"control_protection"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "users can gain control only if at least one admin is in the room"
|
||||
},
|
||||
{
|
||||
|
@ -586,7 +586,7 @@
|
|||
"inactive_cursors"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "show inactive cursors on the screen"
|
||||
},
|
||||
{
|
||||
|
@ -595,7 +595,7 @@
|
|||
"locked_controls"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "whether controls should be locked for users initially"
|
||||
},
|
||||
{
|
||||
|
@ -604,7 +604,7 @@
|
|||
"locked_logins"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "whether logins should be locked for users initially"
|
||||
},
|
||||
{
|
||||
|
@ -622,7 +622,7 @@
|
|||
"private_mode"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "whether private mode should be enabled initially"
|
||||
},
|
||||
{
|
||||
|
@ -640,7 +640,7 @@
|
|||
"debug"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "enables debug logging for the bandwidth estimator"
|
||||
},
|
||||
{
|
||||
|
@ -670,7 +670,7 @@
|
|||
"enabled"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "enables the bandwidth estimator"
|
||||
},
|
||||
{
|
||||
|
@ -690,7 +690,7 @@
|
|||
"passive"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "passive estimator mode, when it does not switch pipelines, only estimates"
|
||||
},
|
||||
{
|
||||
|
@ -749,7 +749,7 @@
|
|||
"icelite"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "configures whether or not the ICE agent should be a lite agent"
|
||||
},
|
||||
{
|
||||
|
@ -826,7 +826,7 @@
|
|||
"debug"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "enable debug mode"
|
||||
},
|
||||
{
|
||||
|
@ -843,7 +843,7 @@
|
|||
"json"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "logs in JSON format"
|
||||
},
|
||||
{
|
||||
|
@ -861,7 +861,7 @@
|
|||
"nocolor"
|
||||
],
|
||||
"type": "boolean",
|
||||
"defaultValue": "true",
|
||||
"defaultValue": "false",
|
||||
"description": "no ANSI colors in non-JSON output"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
import React from 'react';
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
import configOptions from './help.json';
|
||||
|
||||
export default () => {
|
||||
const environmentVariables = () => {
|
||||
let code = '';
|
||||
configOptions.forEach(option => {
|
||||
let value = ""
|
||||
if (option.defaultValue) {
|
||||
value = `"${option.defaultValue}"`
|
||||
} else if (option.type) {
|
||||
value = `<${option.type}>`
|
||||
}
|
||||
code += `# ${option.description}\n`;
|
||||
code += `NEKO_${option.key.join('_').toUpperCase()}: ${value}\n`;
|
||||
});
|
||||
return (
|
||||
<CodeBlock language="yaml">
|
||||
{code}
|
||||
</CodeBlock>
|
||||
);
|
||||
}
|
||||
|
||||
const cmdArguments = () => {
|
||||
let code = '';
|
||||
configOptions.forEach(option => {
|
||||
code += `# ${option.description}\ \n`;
|
||||
code += `--${option.key.join('.')}`;
|
||||
if (option.type) {
|
||||
code += ` <${option.type}>`;
|
||||
}
|
||||
code += '\n';
|
||||
});
|
||||
return (
|
||||
<CodeBlock language="shell">
|
||||
{code}
|
||||
</CodeBlock>
|
||||
);
|
||||
}
|
||||
|
||||
const yamlFile = () => {
|
||||
const final = Symbol('final');
|
||||
|
||||
const buildYaml = (obj, prefix = '') => {
|
||||
let code = '';
|
||||
Object.keys(obj).forEach(key => {
|
||||
const value = obj[key];
|
||||
if (typeof value === 'object' && !Array.isArray(value) && !value[final]) {
|
||||
code += prefix+`${key}:\n`;
|
||||
code += buildYaml(value, prefix + ' ');
|
||||
} else {
|
||||
let val = '';
|
||||
switch (value.type) {
|
||||
case 'boolean':
|
||||
val = `${value.defaultValue || false}`;
|
||||
break;
|
||||
case 'int':
|
||||
case 'float':
|
||||
val = `${value.defaultValue || 0}`;
|
||||
break;
|
||||
case 'strings':
|
||||
val = `[ ${value.defaultValue ? value.defaultValue.map(v => `"${v}"`).join(', ') : '<string>'} ]`;
|
||||
break;
|
||||
case 'duration':
|
||||
case 'string':
|
||||
val = `${value.defaultValue ? `"${value.defaultValue}"` : '<string>'}`;
|
||||
break;
|
||||
default:
|
||||
val = `<${value.type}>`;
|
||||
break;
|
||||
}
|
||||
code += prefix+`# ${value.description || ''}\n`;
|
||||
code += prefix+`${key}: ${val}\n`;
|
||||
}
|
||||
});
|
||||
return code;
|
||||
};
|
||||
|
||||
const yamlCode = buildYaml(configOptions.reduce((acc, option) => {
|
||||
const keys = option.key;
|
||||
let current = acc;
|
||||
keys.forEach((key, index) => {
|
||||
if (!current[key]) {
|
||||
current[key] = index === keys.length - 1 ? option : {};
|
||||
}
|
||||
current = current[key];
|
||||
});
|
||||
current[final] = true;
|
||||
return acc;
|
||||
}, {}));
|
||||
|
||||
return (
|
||||
<CodeBlock language="yaml">
|
||||
{yamlCode}
|
||||
</CodeBlock>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Tabs>
|
||||
<TabItem value="env" label="Environment Variables">
|
||||
<p>You can set the following environment variables in your <code>docker-compose.yaml</code> file or in your shell environment.</p>
|
||||
{environmentVariables()}
|
||||
</TabItem>
|
||||
<TabItem value="args" label="Command Line Arguments">
|
||||
<p>You can list the following command line arguments using <code>neko serve --help</code>.</p>
|
||||
{cmdArguments()}
|
||||
</TabItem>
|
||||
<TabItem value="yaml" label="YAML Configuration File">
|
||||
<p>You can create a <code>/etc/neko/neko.yaml</code> file with the following configuration options.</p>
|
||||
{yamlFile()}
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue