Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit 692d5ff

Browse files
committed
feat: support yaml config format, fix #69
1 parent 5927d76 commit 692d5ff

File tree

3 files changed

+2271
-1797
lines changed

3 files changed

+2271
-1797
lines changed

components/EnvVariableConfig/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import { useState } from 'react';
22
import copy from 'copy-to-clipboard';
33

4-
export function EnvVariableConfig({ variableNames }) {
4+
export function EnvVariableConfig({ variableNames, format }: { variableNames: { key: string; name: string }[]; format?: "yaml" | "env" }) {
55
const [values, setValues] = useState(Array(variableNames.length).fill(''));
66

77
const handleCopy = () => {
8+
if (format === 'yaml') {
9+
const yamlContent = variableNames.map((name, index) => `- ${name.key}: ${values[index]}`).join('\n');
10+
copy(yamlContent);
11+
return;
12+
}
813
const envContent = variableNames.map((name, index) => `${name.key}=${values[index]}`).join('\n');
914
copy(envContent);
1015
};

pages/docs/docker.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ wget https://fastly.jsdelivr.net/gh/mx-space/core@master/docker-compose.yml
4949
import { EnvVariableConfig } from '@components/EnvVariableConfig'
5050

5151
<EnvVariableConfig
52+
format="yaml"
5253
variableNames={[
5354
{
5455
key: 'JWT_SECRET',

0 commit comments

Comments
 (0)