add v2 migration configuration docs.

This commit is contained in:
Miroslav Šedivý 2025-02-19 19:25:10 +01:00
parent 4d0aea6040
commit 33580fe440
9 changed files with 613 additions and 63 deletions

View file

@ -95,6 +95,11 @@ func (Capture) Init(cmd *cobra.Command) error {
return err
}
cmd.PersistentFlags().String("capture.video.pipeline", "", "gstreamer pipeline used for video streaming; shortcut for having only a single video pipeline instead of multiple, ignored if capture.video.pipelines is set")
if err := viper.BindPFlag("capture.video.pipeline", cmd.PersistentFlags().Lookup("capture.video.pipeline")); err != nil {
return err
}
// broadcast
cmd.PersistentFlags().Int("capture.broadcast.audio_bitrate", 128, "broadcast audio bitrate in KB/s")
if err := viper.BindPFlag("capture.broadcast.audio_bitrate", cmd.PersistentFlags().Lookup("capture.broadcast.audio_bitrate")); err != nil {
@ -336,9 +341,30 @@ func (s *Capture) Set() {
log.Warn().Err(err).Msgf("unable to parse video pipelines")
}
// default video
videoPipeline := viper.GetString("capture.video.pipeline")
// if no video pipelines are set
if len(s.VideoPipelines) == 0 {
log.Warn().Msgf("no video pipelines specified, using defaults")
// maybe single video pipeline is set
if videoPipeline != "" {
log.Info().Str("pipeline", videoPipeline).Msg("using single video pipeline")
s.VideoPipelines = map[string]types.VideoConfig{
"main": {
GstPipeline: videoPipeline,
},
}
s.VideoIDs = []string{"main"}
if viper.GetBool("legacy") {
legacyPipeline := s.VideoPipelines["main"]
// Hacky way to enable pointer for legacy pipeline.
legacyPipeline.GstPipeline = strings.Replace(legacyPipeline.GstPipeline, "show-pointer=false", "show-pointer=true", 1)
s.VideoPipelines["legacy"] = legacyPipeline
// we do not add legacy to VideoIDs so that its ignored by bandwidth estimator
}
} else {
log.Warn().Msgf("no video pipelines specified, using default")
s.VideoCodec = codec.VP8()
s.VideoPipelines = map[string]types.VideoConfig{
@ -370,6 +396,9 @@ func (s *Capture) Set() {
// we do not add legacy to VideoIDs so that its ignored by bandwidth estimator
}
}
} else if videoPipeline != "" {
log.Warn().Msg("you are setting both single video pipeline and multiple video pipelines, ignoring single video pipeline")
}
// audio
s.AudioDevice = viper.GetString("capture.audio.device")
@ -477,8 +506,13 @@ func (s *Capture) SetV2() {
}
// we do not add legacy to VideoIDs so that its ignored by bandwidth estimator
s.VideoIDs = []string{"main"}
// TODO: add deprecated warning and proper alternative
}
if videoPipeline != "" {
log.Warn().Msg("you are using deprecated config setting 'NEKO_VIDEO' which is deprecated, please use 'NEKO_CAPTURE_VIDEO_PIPELINE' instead")
}
// TODO: add deprecated warning and proper alternative for HW enc, bitrate and max fps
}
//
@ -524,7 +558,12 @@ func (s *Capture) SetV2() {
} else {
s.AudioPipeline = pipeline
}
// TODO: add deprecated warning and proper alternative
if audioPipeline != "" {
log.Warn().Msg("you are using deprecated config setting 'NEKO_AUDIO' which is deprecated, please use 'NEKO_CAPTURE_AUDIO_PIPELINE' instead")
}
// TODO: add deprecated warning and proper alternative for audio bitrate
}
//

View file

@ -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

View file

@ -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"
},
{

View file

@ -0,0 +1,125 @@
---
sidebar_position: 8
---
# V2 Migration Guide
## Configuration
V3 is compatible with V2 configuration options when legacy support is enabled. You should be able to run V3 with the V2 configuration without any issues.
The configuration in Neko V3 has been structured differently compared to V2. The V3 configuration is more modular and allows for more flexibility. The V3 configuration is split into multiple sections, each section is responsible for a specific part of the application. This allows for better organization and easier management of the configuration.
In order to migrate from V2 to V3, you need to update the configuration to the new format. The following table shows the mapping between the V2 and V3 configuration options.
| **V2 Configuration** | **V3 Configuration** |
|---------------------------------------|-----------------------------------------------------------|
| `NEKO_LOGS` *removed* | `NEKO_LOG_DIR=/path/to/logs` |
| `NEKO_CERT` | `NEKO_SERVER_CERT` |
| `NEKO_KEY` | `NEKO_SERVER_KEY` |
| `NEKO_BIND` | `NEKO_SERVER_BIND` |
| `NEKO_PROXY` | `NEKO_SERVER_PROXY` |
| `NEKO_STATIC` | `NEKO_SERVER_STATIC` |
| `NEKO_PATH_PREFIX` | `NEKO_SERVER_PATH_PREFIX` |
| `NEKO_CORS` | `NEKO_SERVER_CORS` |
| `NEKO_LOCKS` | `NEKO_SESSION_LOCKED_CONTROLS` and `NEKO_SESSION_LOCKED_LOGINS`, <br /> V3 allows separate locks for controls and logins |
| `NEKO_IMPLICIT_CONTROL` | `NEKO_SESSION_IMPLICIT_HOSTING` |
| `NEKO_CONTROL_PROTECTION` | `NEKO_SESSION_CONTROL_PROTECTION` |
| `NEKO_HEARTBEAT_INTERVAL` | `NEKO_SESSION_HEARTBEAT_INTERVAL` |
See the V3 [configuration options](/docs/v3/getting-started/configuration).
### WebRTC Video
See the V3 configuration options for the [WebRTC Video](/docs/v3/getting-started/configuration/capture#webrtc-video).
| **V2 Configuration** | **V3 Configuration** |
|---------------------------------------|-----------------------------------------------------------|
| `NEKO_DISPLAY` | `NEKO_CAPTURE_VIDEO_DISPLAY` and `NEKO_DESKTOP_DISPLAY`, <br /> consider using `DISPLAY` env variable if both should be the same |
| `NEKO_VIDEO_CODEC` | `NEKO_CAPTURE_VIDEO_CODEC` |
| `NEKO_AV1=true` *deprecated* | `NEKO_CAPTURE_VIDEO_CODEC=av1` |
| `NEKO_H264=true` *deprecated* | `NEKO_CAPTURE_VIDEO_CODEC=h264` |
| `NEKO_VP8=true` *deprecated* | `NEKO_CAPTURE_VIDEO_CODEC=vp8` |
| `NEKO_VP9=true` *deprecated* | `NEKO_CAPTURE_VIDEO_CODEC=vp9` |
| `NEKO_VIDEO` | `NEKO_CAPTURE_VIDEO_PIPELINE`, V3 allows multiple video pipelines |
| `NEKO_VIDEO_BITRATE` | **removed**, use custom pipeline instead |
| `NEKO_HWENC` | **removed**, use custom pipeline instead |
| `NEKO_MAX_FPS` | **removed**, use custom pipeline instead |
:::warning
V2 did not have client-side cursor support, the cursor was always part of the video stream. In V3, the cursor is sent separately from the video stream. Therefore, when using legacy configuration, there will be two video streams created, one with the cursor (for V2 clients) and one without the cursor (for V3 clients). Please consider using new configuration options if this is not the desired behavior.
:::
### WebRTC Audio
See the V3 configuration options for the [WebRTC Audio](/docs/v3/getting-started/configuration/capture#webrtc-audio).
| **V2 Configuration** | **V3 Configuration** |
|---------------------------------------|-----------------------------------------------------------|
| `NEKO_DEVICE` | `NEKO_CAPTURE_AUDIO_DEVICE` |
| `NEKO_AUDIO_CODEC` | `NEKO_CAPTURE_AUDIO_CODEC` |
| `NEKO_G722=true` *deprecated* | `NEKO_CAPTURE_AUDIO_CODEC=g722` |
| `NEKO_OPUS=true` *deprecated* | `NEKO_CAPTURE_AUDIO_CODEC=opus` |
| `NEKO_PCMA=true` *deprecated* | `NEKO_CAPTURE_AUDIO_CODEC=pcma` |
| `NEKO_PCMU=true` *deprecated* | `NEKO_CAPTURE_AUDIO_CODEC=pcmu` |
| `NEKO_AUDIO` | `NEKO_CAPTURE_AUDIO_PIPELINE` |
| `NEKO_AUDIO_BITRATE` | **removed**, use custom pipeline instead |
### Broadcast
See the V3 configuration options for the [Broadcast](/docs/v3/getting-started/configuration/capture#broadcast).
| **V2 Configuration** | **V3 Configuration** |
|---------------------------------------|-----------------------------------------------------------|
| `NEKO_BROADCAST_PIPELINE` | `NEKO_CAPTURE_BROADCAST_PIPELINE` |
| `NEKO_BROADCAST_URL` | `NEKO_CAPTURE_BROADCAST_URL` |
| `NEKO_BROADCAST_AUTOSTART` | `NEKO_CAPTURE_BROADCAST_AUTOSTART` |
### Desktop
See the V3 configuration options for the [Desktop](/docs/v3/getting-started/configuration/desktop).
| **V2 Configuration** | **V3 Configuration** |
|---------------------------------------|-----------------------------------------------------------|
| `NEKO_SCREEN` | `NEKO_DESKTOP_SCREEN` |
### Authentication
See the V3 configuration options for the [Authentication](/docs/v3/getting-started/configuration/authentication).
| **V2 Configuration** | **V3 Configuration** |
|---------------------------------------|-----------------------------------------------------------|
| `NEKO_PASSWORD` | `NEKO_MEMBER_MULTIUSER_USER_PASSWORD` with `NEKO_MEMBER_PROVIDER=multiuser` |
| `NEKO_PASSWORD_ADMIN` | `NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD` with `NEKO_MEMBER_PROVIDER=multiuser` |
In order for the legacy authentication to work, you need to set [Multi-user](http://localhost:3000/docs/v3/getting-started/configuration/authentication#multi-user-provider).
:::warning
V2 clients might not be compatible with any other authentication provider than the `multiuser`.
:::
### WebRTC
See the V3 configuration options for the [WebRTC](/docs/v3/getting-started/configuration/webrtc).
| **V2 Configuration** | **V3 Configuration** |
|---------------------------------------|-----------------------------------------------------------|
| `NEKO_NAT1TO1` | `NEKO_WEBRTC_NAT1TO1` |
| `NEKO_TCPMUX` | `NEKO_WEBRTC_TCPMUX` |
| `NEKO_UDPMUX` | `NEKO_WEBRTC_UDPMUX` |
| `NEKO_ICELITE` | `NEKO_WEBRTC_ICELITE` |
| `NEKO_ICESERVERS` or `NEKO_ICESERVER` | `NEKO_WEBRTC_ICESERVERS_FRONTEND` and `NEKO_WEBRTC_ICESERVERS_BACKEND`, <br /> V3 allows separate ICE servers for frontend and backend |
| `NEKO_IPFETCH` | `NEKO_WEBRTC_IP_RETRIEVAL_URL` |
| `NEKO_EPR` | `NEKO_WEBRTC_EPR` |
### Full V2 Configuration Reference
Here is a full list of all the configuration options available in Neko V2 that are still available in Neko V3 with legacy support enabled.
import Configuration from '@site/src/components/Configuration';
import configOptions from './help.json';
<Configuration configOptions={configOptions} />
See the full [V3 configuration reference](/docs/v3/getting-started/configuration/#full-configuration-reference) for more details.

View file

@ -0,0 +1,317 @@
[
{
"key": [
"display"
],
"type": "string",
"description": "XDisplay to capture"
},
{
"key": [
"video_codec"
],
"type": "string",
"description": "video codec to be used"
},
{
"key": [
"av1"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use video_codec"
},
{
"key": [
"h264"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use video_codec"
},
{
"key": [
"vp8"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use video_codec"
},
{
"key": [
"vp9"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use video_codec"
},
{
"key": [
"video"
],
"type": "string",
"description": "video codec parameters to use for streaming"
},
{
"key": [
"video_bitrate"
],
"type": "int",
"description": "video bitrate in kbit/s"
},
{
"key": [
"hwenc"
],
"type": "string",
"description": "use hardware accelerated encoding"
},
{
"key": [
"max_fps"
],
"type": "int",
"description": "maximum fps delivered via WebRTC, 0 is for no maximum"
},
{
"key": [
"device"
],
"type": "string",
"description": "audio device to capture"
},
{
"key": [
"audio_codec"
],
"type": "string",
"description": "audio codec to be used"
},
{
"key": [
"g722"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use audio_codec"
},
{
"key": [
"opus"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use audio_codec"
},
{
"key": [
"pcma"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use audio_codec"
},
{
"key": [
"pcmu"
],
"type": "boolean",
"defaultValue": "false",
"description": "DEPRECATED: use audio_codec"
},
{
"key": [
"audio"
],
"type": "string",
"description": "audio codec parameters to use for streaming"
},
{
"key": [
"audio_bitrate"
],
"type": "int",
"description": "audio bitrate in kbit/s"
},
{
"key": [
"broadcast_pipeline"
],
"type": "string",
"description": "custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced"
},
{
"key": [
"broadcast_url"
],
"type": "string",
"description": "a default default URL for broadcast streams, can be disabled/changed later by admins in the GUI"
},
{
"key": [
"broadcast_autostart"
],
"type": "boolean",
"defaultValue": "false",
"description": "automatically start broadcasting when neko starts and broadcast_url is set"
},
{
"key": [
"screen"
],
"type": "string",
"description": "default screen resolution and framerate"
},
{
"key": [
"password"
],
"type": "string",
"description": "password for connecting to stream"
},
{
"key": [
"password_admin"
],
"type": "string",
"description": "admin password for connecting to stream"
},
{
"key": [
"cert"
],
"type": "string",
"description": "path to the SSL cert used to secure the neko server"
},
{
"key": [
"key"
],
"type": "string",
"description": "path to the SSL key used to secure the neko server"
},
{
"key": [
"bind"
],
"type": "string",
"description": "address/port/socket to serve neko"
},
{
"key": [
"proxy"
],
"type": "boolean",
"defaultValue": "false",
"description": "enable reverse proxy mode"
},
{
"key": [
"static"
],
"type": "string",
"description": "path to neko client files to serve"
},
{
"key": [
"path_prefix"
],
"type": "string",
"description": "path prefix for HTTP requests"
},
{
"key": [
"cors"
],
"type": "strings",
"description": "list of allowed origins for CORS"
},
{
"key": [
"locks"
],
"type": "strings",
"description": "resources, that will be locked when starting (control, login)"
},
{
"key": [
"implicit_control"
],
"type": "boolean",
"defaultValue": "false",
"description": "if enabled members can gain control implicitly"
},
{
"key": [
"control_protection"
],
"type": "boolean",
"defaultValue": "false",
"description": "control protection means, users can gain control only if at least one admin is in the room"
},
{
"key": [
"heartbeat_interval"
],
"type": "int",
"defaultValue": "120",
"description": "heartbeat interval in seconds"
},
{
"key": [
"nat1to1"
],
"type": "strings",
"description": "sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP "
},
{
"key": [
"tcpmux"
],
"type": "int",
"description": "single TCP mux port for all peers"
},
{
"key": [
"udpmux"
],
"type": "int",
"description": "single UDP mux port for all peers"
},
{
"key": [
"icelite"
],
"type": "boolean",
"defaultValue": "false",
"description": "configures whether or not the ice agent should be a lite agent"
},
{
"key": [
"iceserver"
],
"type": "strings",
"description": "describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection "
},
{
"key": [
"iceservers"
],
"type": "string",
"description": "describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection "
},
{
"key": [
"ipfetch"
],
"type": "string",
"description": "automatically fetch IP address from given URL when nat1to1 is not present"
},
{
"key": [
"epr"
],
"type": "string",
"description": "limits the pool of ephemeral ports that ICE UDP connections can allocate from"
}
]

View file

@ -0,0 +1,49 @@
--display string XDisplay to capture
--video_codec string video codec to be used
--av1 DEPRECATED: use video_codec
--h264 DEPRECATED: use video_codec
--vp8 DEPRECATED: use video_codec
--vp9 DEPRECATED: use video_codec
--video string video codec parameters to use for streaming
--video_bitrate int video bitrate in kbit/s
--hwenc string use hardware accelerated encoding
--max_fps int maximum fps delivered via WebRTC, 0 is for no maximum
--device string audio device to capture
--audio_codec string audio codec to be used
--g722 DEPRECATED: use audio_codec
--opus DEPRECATED: use audio_codec
--pcma DEPRECATED: use audio_codec
--pcmu DEPRECATED: use audio_codec
--audio string audio codec parameters to use for streaming
--audio_bitrate int audio bitrate in kbit/s
--broadcast_pipeline string custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced
--broadcast_url string a default default URL for broadcast streams, can be disabled/changed later by admins in the GUI
--broadcast_autostart automatically start broadcasting when neko starts and broadcast_url is set
--screen string default screen resolution and framerate
--password string password for connecting to stream
--password_admin string admin password for connecting to stream
--cert string path to the SSL cert used to secure the neko server
--key string path to the SSL key used to secure the neko server
--bind string address/port/socket to serve neko
--proxy enable reverse proxy mode
--static string path to neko client files to serve
--path_prefix string path prefix for HTTP requests
--cors strings list of allowed origins for CORS
--locks strings resources, that will be locked when starting (control, login)
--implicit_control if enabled members can gain control implicitly
--control_protection control protection means, users can gain control only if at least one admin is in the room
--heartbeat_interval int heartbeat interval in seconds (default 120)
--nat1to1 strings sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP
--tcpmux int single TCP mux port for all peers
--udpmux int single UDP mux port for all peers
--icelite configures whether or not the ice agent should be a lite agent
--iceserver strings describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection
--iceservers string describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection
--ipfetch string automatically fetch IP address from given URL when nat1to1 is not present
--epr string limits the pool of ephemeral ports that ICE UDP connections can allocate from

View file

@ -10,6 +10,8 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"gen-help": "node ./src/components/Configuration/generate.js ./docs/getting-started/configuration/help.txt ./docs/getting-started/configuration/help.json",
"gen-help:v2": "node ./src/components/Configuration/generate.js ./docs/getting-started/v2-migration/help.txt ./docs/getting-started/v2-migration/help.json",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"gen-api-docs": "docusaurus gen-api-docs all",

View file

@ -1,6 +1,5 @@
/* This script reads the help.txt file and generates a help.json file with the configuration options. */
/* This script reads a 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');
@ -12,7 +11,9 @@ const parseConfigOptions = (text) => {
if (!type) {
type = 'boolean';
// if the default value is not specified, it is false
if (defaultValue !== 'false') {
if (!defaultValue) {
defaultValue = 'false';
} else if (defaultValue !== 'false') {
defaultValue = 'true';
}
}
@ -22,20 +23,24 @@ const parseConfigOptions = (text) => {
}).filter(option => option !== null);
};
const filePath = path.resolve(__dirname, 'help.txt');
const outputFilePath = path.resolve(__dirname, 'help.json');
const [,, inputFilePath, outputFilePath] = process.argv;
fs.readFile(filePath, 'utf8', (err, data) => {
if (!inputFilePath || !outputFilePath) {
console.error('Usage: node generate.js <inputFilePath> <outputFilePath>');
process.exit(1);
}
fs.readFile(inputFilePath, 'utf8', (err, data) => {
if (err) {
console.error('Error reading help file:', err);
console.error('Error reading input 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);
console.error('Error writing output file:', err);
} else {
console.log('Help file generated successfully.');
console.log('Output file generated successfully.');
}
});
});

View file

@ -2,9 +2,19 @@ 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 () => {
interface ConfigOption {
key: string[];
description: string;
defaultValue?: string;
type?: string;
}
interface ConfigurationTabProps {
configOptions: ConfigOption[];
}
const ConfigurationTab: React.FC<ConfigurationTabProps> = ({ configOptions }) => {
const environmentVariables = () => {
let code = '';
configOptions.forEach(option => {
@ -27,7 +37,7 @@ export default () => {
const cmdArguments = () => {
let code = '';
configOptions.forEach(option => {
code += `# ${option.description}\ \n`;
code += `# ${option.description}\n`;
code += `--${option.key.join('.')}`;
if (option.type) {
code += ` <${option.type}>`;
@ -118,3 +128,5 @@ export default () => {
</div>
);
};
export default ConfigurationTab;