This repository was archived by the owner on Nov 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +2271
-1797
lines changed
components/EnvVariableConfig Expand file tree Collapse file tree 3 files changed +2271
-1797
lines changed Original file line number Diff line number Diff line change 1
1
import { useState } from 'react' ;
2
2
import copy from 'copy-to-clipboard' ;
3
3
4
- export function EnvVariableConfig ( { variableNames } ) {
4
+ export function EnvVariableConfig ( { variableNames, format } : { variableNames : { key : string ; name : string } [ ] ; format ?: "yaml" | "env" } ) {
5
5
const [ values , setValues ] = useState ( Array ( variableNames . length ) . fill ( '' ) ) ;
6
6
7
7
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
+ }
8
13
const envContent = variableNames . map ( ( name , index ) => `${ name . key } =${ values [ index ] } ` ) . join ( '\n' ) ;
9
14
copy ( envContent ) ;
10
15
} ;
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ wget https://fastly.jsdelivr.net/gh/mx-space/core@master/docker-compose.yml
49
49
import { EnvVariableConfig } from ' @components/EnvVariableConfig'
50
50
51
51
<EnvVariableConfig
52
+ format = " yaml"
52
53
variableNames = { [
53
54
{
54
55
key: ' JWT_SECRET' ,
You can’t perform that action at this time.
0 commit comments