lsh-framework 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -144,7 +144,7 @@ export class SecretsManager {
|
|
|
144
144
|
/**
|
|
145
145
|
* Pull .env from Supabase
|
|
146
146
|
*/
|
|
147
|
-
async pull(envFilePath = '.env', environment = 'dev') {
|
|
147
|
+
async pull(envFilePath = '.env', environment = 'dev', force = false) {
|
|
148
148
|
logger.info(`Pulling ${environment} secrets from Supabase...`);
|
|
149
149
|
// Get latest secrets
|
|
150
150
|
const jobs = await this.persistence.getActiveJobs();
|
|
@@ -159,8 +159,8 @@ export class SecretsManager {
|
|
|
159
159
|
throw new Error(`No encrypted data found for environment: ${environment}`);
|
|
160
160
|
}
|
|
161
161
|
const decrypted = this.decrypt(latestSecret.output);
|
|
162
|
-
// Backup existing .env if it exists
|
|
163
|
-
if (fs.existsSync(envFilePath)) {
|
|
162
|
+
// Backup existing .env if it exists (unless force is true)
|
|
163
|
+
if (fs.existsSync(envFilePath) && !force) {
|
|
164
164
|
const backup = `${envFilePath}.backup.${Date.now()}`;
|
|
165
165
|
fs.copyFileSync(envFilePath, backup);
|
|
166
166
|
logger.info(`Backed up existing .env to ${backup}`);
|
|
@@ -32,10 +32,11 @@ export async function init_secrets(program) {
|
|
|
32
32
|
.description('Pull .env from encrypted cloud storage')
|
|
33
33
|
.option('-f, --file <path>', 'Path to .env file', '.env')
|
|
34
34
|
.option('-e, --env <name>', 'Environment name (dev/staging/prod)', 'dev')
|
|
35
|
+
.option('--force', 'Overwrite without creating backup')
|
|
35
36
|
.action(async (options) => {
|
|
36
37
|
try {
|
|
37
38
|
const manager = new SecretsManager();
|
|
38
|
-
await manager.pull(options.file, options.env);
|
|
39
|
+
await manager.pull(options.file, options.env, options.force);
|
|
39
40
|
}
|
|
40
41
|
catch (error) {
|
|
41
42
|
console.error('❌ Failed to pull secrets:', error.message);
|