clei

1.3.1 • Public • Published

Environments CLI

Important

  • Just tested in MacOS
  • Using crypto
    • Just tested with the aes-256-ctr algorithm for file encryption. Must use AES algorithms
      • Cipher key must be 32 chars for the 256 algorithms
  • A users-projects.json is used as our database.
    • It's encrypted in S3, so we can't edit it directly
    • It should contain all users, admins, projects and user permissions in projects.
  • Install the project locally with npm install -g

Requirements

  • Single Folder for all Projects
    • Ex: /Users/user1/Developer/
  • AWS Private Bucket
  • Tested with Node Versions >= 12.x.x

User Usage

command clei stands for Command Line Environment Interface

Config

clei config

  • Configures the environment for a non-admin user

    Asks for Description
    Your email Your email
    Your Key Key provided by admin
    Data Data provided by admin
    Your Projects Path Path containing all your projects in your computer

Re-configure

clei path

  • Sets you local path for your projects in your computer

    Asks for Description
    Your Projects Path A valid path in your computer

clei email

  • Sets you email to authorization your projects environments

    Asks for Description
    Your Email A valid email

clei key

  • Sets you key to authorization your projects environments

    Asks for Description
    Your Key A valid key

Download environment

clei download

  • Downloads the environment file for a project, decrypts it and overwrites it on the disk if exists.

  • The project needs to exist in your computer.

    Asks for Description
    Project Name A valid Project Name
    Stage The stage(s) of the environment to be downloaded
  • This command could be inlined with clei download PROJECT STAGE

    • Multiple stages should be separated by commas
    • For multiple json files the first stage will be applied to the file

Output environment

clei output

  • Downloads the environment file for a project, decrypts it and outputs it in process.stdout.write

  • The project needs to exist in your computer.

    Asks for Description
    Project Name A valid Project Name
    Stage The stage(s) of the environment to be downloaded
  • This command could be inlined with clei download PROJECT STAGE

    • Multiple stages should be separated by commas
    • For multiple json files the first stage will be applied to the file

Admin Usage

command clei stands for Command Line Environment Interface

Initialize

clei init

  • Setups the environment for the admin and Creates the users-projects.json Encrypted JSON file in S3.

    Asks for Description
    Encryption Algorithm Algorithm to encrypt files. Defaults to aes-256-ctr
    File Key Key to encrypt and decrypt files. Must be 32 characters in length
    AWS Access Key ID Your AWS Access Key ID
    AWS Secret Access Key Your AWS Secret Access Key
    AWS Bucket Name The name of the bucket where the credentials will be stored. It's recommended to make it private and use AWS encryption
    Admin Email First email to be configured as admin
    Admin Name Name of the admin
    Projects Path Path containing all projects in your computer

Share environment variables

clei share

  • Generates an encrypted string with the target user key

    Asks for Description
    User Email email from the target user

CRUD Credentials

clei get credential

  • Gets the credential value for a project

    Asks for Description
    Project name The name of the folder where the project is stored
    Stage The stage from the credential
    Key The key for the credential. Case Sensitive
  • This command could be inlined with clei get credential PROJECT STAGE KEY

clei create credential

  • creates a credential value for a project

    Asks for Description
    Project Name The name of the folder where the project is stored. It should match with the same name in the users-projects.json file
    Stages The stages for the environments files to add the credential to. It takes the stages configured in the users-projects.json file as inputs.
    Credential type Only if project type is not .env. Value Type of the credential that will be added (string, boolean, int, float)
    Credential Key The Key for your credential. For nested credentials you can separate it using a dot. (ex: the keys for { DB_HOST: { MYSQL: 'local' } should be specified as DB_HOST.MYSQL})
    Credential Value The Value for your credential.
  • This command could be inlined with clei create credential PROJECT STAGE KEY TYPE VALUE

    • STAGE could be multiple stages separated by commas
    • TYPE is only necessary on .json files
    • VALUE should match type (only on .json files)

clei update credential

  • updates a credential value for a project stage or stages

    Asks for Description
    Project Name The name of the folder where the project is stored. It should match with the same name in the users-projects.json file
    Stages The stages for the environments files to add the credential to. It takes the stages configured in the users-projects.json file as inputs.
    Credential type Only if project type is not .env. Value Type of the credential that will be added (string, boolean, int, float)
    Credential Key The Key for your credential. For nested credentials you can separate it using a dot. (ex: the keys for { DB_HOST: { MYSQL: 'local' } should be specified as DB_HOST.MYSQL})
    Credential Value The Value for your credential.
  • This command could be inlined with clei update credential PROJECT STAGE KEY TYPE VALUE

    • STAGE could be multiple stages separated by commas
    • TYPE is only necessary on .json files
    • VALUE should match type (only on .json files)

CRUD Users

clei get user

  • Gets the user details in users-projects.json

    Asks for Description
    User Email email from the user. Leave blank for all users

clei create user

  • Creates a user in the users-projects.json file. Generates a random string with 16 characters as key

    Asks for Description
    User Email to search User Email corresponding to the user that we want to edit
    New Name New User Name
    New Email New User Email
    Generate new key? If yes it generates a new key for the user

clei update user

  • Updates an existing user in the users-projects.json file.

    Asks for Description
    Name User Name
    Email User Email

clei delete user

  • Deletes the user from users-projects.json

    Asks for Description
    User Email email from the user to be deleted

CRUD Projects

clei get project

  • Gets the project details in users-projects.json

    Asks for Description
    Project Name Project Name. Leave blank for all projects

clei create project

  • Creates a project in the users-projects.json file.

    Asks for Description
    Project Name The name of the folder where the project will be stored
    Environment File path The internal path for the environment files in the project
    Environment File Format The name format for the environment files. STAGE will be replaced accordingly
    Stages The stages for the project separated by commas

clei update project

  • Updates an existing project in the users-projects.json file.

    Asks for Description
    Project Name The name of the folder to search to update the project
    New Project Name to search The new name of the folder where the project will be stored
    New Environment File path The new internal path for the environment files in the project
    New Environment File Format The new name format for the environment files. STAGE will be replaced accordingly
    New Stages The new stages for the project separated by commas

clei delete project

  • delete the project from users-projects.json

    Asks for Description
    Project Name Project Name of the project to be deleted

Credentials File

clei add file

  • Uploads a local environment file to the S3 bucket.

  • The Project needs to exist in the users-projects.json file and in your computer.

  • This action overwrites the file in the bucket so use it carefully

    Asks for Description
    Project Name The name of the folder where the project is stored. It should match with the same name in the users-projects.json file
    Stage The stage for the environment file that will be uploaded. It takes the stages configured in the users-projects.json file as inputs. (If the file is multiple-json then we should check all the stages that we want to make available)
    Environment File Format The name format for the environment files. STAGE will be replaced accordingly
    Stages The stages for the project separated by commas

clei delete file

  • Deletes a file from a project on the S3 bucket.

  • The Project needs to exist in the users-projects.json

    Asks for Description
    Project Name The name of the folder where the project is stored. It should match with the same name in the users-projects.json file
    Files Select the files that you wish to delete from s3

Manage User Access to Projects

clei access

  • Manage a user stages authorization to a project

    Asks for Description
    User Email The user email that will be authorized
    Project Name The name of the folder where the project is stored.
    Stages granted The stages to give permissions to the user

Manage admins

clei auth

  • Manage a user admin permissions

    Asks for Description
    User Email The user email that will be authorized
    Actions The actions that this admin can perform

Readme

Keywords

none

Package Sidebar

Install

npm i clei

Weekly Downloads

2

Version

1.3.1

License

MIT

Unpacked Size

86.7 kB

Total Files

27

Last publish

Collaborators

  • kenri
  • ntorres144
  • cass2304
  • josue.sosa