Init Command
The init
command initializes dlabs-env and sets up the master password for secure environment variable management.
Usage
bash
# Using npx (recommended)
npx dlabs-env@latest init
# Or if installed globally
dlabs-env init
Description
The init
command is the first command you should run when setting up dlabs-env. It performs the following steps:
- Checks if dlabs-env is already initialized
- Creates the configuration directory if it doesn't exist
- Guides you through creating a secure master password
- Sets up the encryption system with your master password
- Initializes the configuration files with proper permissions
Master Password Requirements
When creating your master password, it must meet these security requirements:
- Minimum 12 characters
- At least 1 uppercase letter (A-Z)
- At least 1 lowercase letter (a-z)
- At least 1 number (0-9)
- At least 1 special character (!@#$%^&*)
Files Created
The initialization process creates several files in your configuration directory:
.master.key
: Encrypted master key file.salt
: Salt used for key derivation.config
: Tool configuration file.db-config
: Encrypted environment variables storage
Examples
First-time initialization
bash
npx dlabs-env@latest init
Reinitializing (requires confirmation)
bash
npx dlabs-env@latest init
# You will be prompted for confirmation
Common Issues
Permission Denied
- Solution: Check directory permissions
- For global installation: Use sudo (Unix) or run as administrator (Windows)
- Recommended: Use npx to avoid permission issues
Already Initialized
- The tool will ask for confirmation before reinitializing
- Reinitializing will create a new master key and reset all configurations
Invalid Password
- Make sure your password meets all requirements
- The tool will keep prompting until a valid password is provided
Related Commands
- status - Check the environment status