Socket
Socket
Sign inDemoInstall

securenv

Package Overview
Dependencies
12
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.6 to 2.0.7

59

index.js
#!/usr/bin/env node
require('dotenv').config()
const { program } = require('commander');
const rest = require('./integration/securenv-rest');const fs = require('fs');
const rest = require('./integration/securenv-rest'); const fs = require('fs');

@@ -27,10 +27,10 @@

const filename = '.gitignore';
let content = '.env*'
let content = '.env*'
if(fs.existsSync(filename)) {
if (fs.existsSync(filename)) {
content = fs.readFileSync(filename, 'utf8');
if(!content.includes('.env*'))
if (!content.includes('.env*'))
content += '\n.env*'
}
}

@@ -45,3 +45,3 @@ return fs.writeFileSync(filename, content);

var package = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));
const template = {

@@ -54,3 +54,3 @@ project: package ? package.name : '',

console.log('Options => ', opts)
console.log('Options => ', opts)

@@ -72,7 +72,7 @@ return opts;

.action(async (login, password, host) => {
try {
try {
console.log(`Creating configuration file at [${__dirname}/.securenv]`)
const config = await rest.login(host, login, password)
const config = await rest.login(host, login, password)
fs.writeFileSync(`${__dirname}/.securenv`, JSON.stringify(config));
console.log('You are in!');
console.log('You are in!');
}

@@ -93,6 +93,6 @@ catch (error) {

const environments = await rest.list(project)
if(environments) {
if (environments) {
console.log(`Listing [${environments.length}] environments for [${project}]...`);
environments.map(env => {
console.log(`=> ${env.project.toUpperCase()} at ${env.environment} has ${env.versions.length+1} version(s):`);
console.log(`=> ${env.project.toUpperCase()} at ${env.environment} has ${env.versions.length + 1} version(s):`);
console.log('');

@@ -116,3 +116,3 @@ console.log(` - CURRENT by ${env.login} updated at ${env.updatedAt}`);

program.command('get')
program.command('get')
.description('Get environment file')

@@ -127,4 +127,4 @@ .option('-p, --project [Project name]', 'Name of the project')

const result = await rest.get(project, environment, version)
if(result) {
if (result) {
console.log(`Retreiving [${result.length}] environments from [${project}]`)

@@ -159,11 +159,11 @@ result.map(env => {

if(environment == 'all' && !version) {
if (environment == 'all' && !version) {
console.log('You must specify an environment or a version');
return;
}
const result = await rest.get(project, environment, version)
if(result) {
const env = result.shift();
if (result) {
const env = result.shift();
console.log(`Showing [${env.project}] [${env.environment}] [${version || 'current'}] ...`);

@@ -191,3 +191,3 @@ console.log(`Author [${env.login}] at [${env.updatedAt}]`);

const { project } = getDefaultOptions(options)
const content = getEnvFile(environment)
const content = getEnvFile(environment)
await rest.set(project, environment, content)

@@ -203,4 +203,21 @@ console.log(`Uploading environment [${project}] [${environment}]...`);

program
.command('sync')
.description('Sync variables with pipeline')
.argument('<environment>', 'Environment of env file to be upload')
.option('-p, --project [Project name]', 'Name of the project')
.action(async (environment, options) => {
try {
const { project } = getDefaultOptions(options)
await rest.sync(project, environment)
console.log(`Uploading environment to bitbucket [${project}] [${environment}]...`);
console.log('Done! Your environment was uploaded to bitbucket!');;
}
catch (error) {
console.log(error.message);
}
})
program.parse();
{
"name": "securenv",
"version": "2.0.6",
"version": "2.0.7",
"description": "Securenv its a CLI for securenv API that stores and gets secure env files",

@@ -5,0 +5,0 @@ "bin": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc