@@ -12,35 +12,41 @@ import {
1212} from "../lib/vault.js"
1313import { writeStep , writeSuccess } from "../lib/write.js"
1414
15- export async function addVaultPassword ( ) {
16- let trellisPath = getTrellisPath ( )
17- let vaultPassPath = `${ trellisPath } /.vault_pass`
18- let password = generator . generate ( {
15+ export async function generateVaultPass (
16+ vaultPassPath = `${ process . cwd ( ) } /.vault_pass` ,
17+ ) {
18+ console . log ( vaultPassPath )
19+ const password = generator . generate ( {
1920 length : 32 ,
2021 numbers : true ,
2122 } )
2223
23- fs . writeFile ( vaultPassPath , password , ( err ) => {
24+ fs . writeFile ( vaultPassPath , password , { encoding : "utf8" } , ( err ) => {
2425 if ( err ) {
2526 console . log ( err )
2627 }
2728 } )
28-
2929 conf . set ( "vaultPass" , password )
3030
3131 writeSuccess ( `Vault pass written to ${ vaultPassPath } ` )
3232}
3333
34+ export async function addVaultPassword ( ) {
35+ const trellisPath = getTrellisPath ( )
36+ const vaultPassPath = `${ trellisPath } /.vault_pass`
37+ await generateVaultPass ( vaultPassPath )
38+ }
39+
3440export async function changeVaultPasswords ( ) {
3541 writeStep ( "Update all vault files with new vault pass" )
3642
37- let lisaVaultPassPath = getLisaVaultPassPath ( )
38- let vaultPassPath = getVaultPassPath ( )
43+ const lisaVaultPassPath = getLisaVaultPassPath ( )
44+ const vaultPassPath = getVaultPassPath ( )
3945
40- let allGroupVarsPath = getGroupVarsPath ( "all" )
41- let developmentGroupVarsPath = getGroupVarsPath ( "development" )
42- let stagingGroupVarsPath = getGroupVarsPath ( "staging" )
43- let productionGroupVarsPath = getGroupVarsPath ( "production" )
46+ const allGroupVarsPath = getGroupVarsPath ( "all" )
47+ const developmentGroupVarsPath = getGroupVarsPath ( "development" )
48+ const stagingGroupVarsPath = getGroupVarsPath ( "staging" )
49+ const productionGroupVarsPath = getGroupVarsPath ( "production" )
4450
4551 await writeTempLisaVaultPass ( )
4652
0 commit comments