dorky
v2.4.1
Published
DevOps Records Keeper.
Readme
dorky
__ __
.--| .-----.----| |--.--.--.
| _ | _ | _| <| | |
|_____|_____|__| |__|__|___ |
|_____|
&&
Overview
Manage sensitive project files like environment variables, configuration files, and API keys without committing them to public version control. dorky securely stores your sensitive files on AWS S3 or Google Drive, making them accessible to authorized team members.
Installation
npm install -g dorkyOr use with npx:
npx dorky --helpPrerequisites
AWS S3
- Create an S3 bucket in your AWS account
- Create an IAM user with programmatic access
- Attach the following IAM policy to the user (replace
your-bucket-namewith your actual bucket name):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::your-bucket-name",
"arn:aws:s3:::your-bucket-name/*"
]
}
]
}- Generate AWS credentials (Access Key ID and Secret Access Key) for the IAM user
- Set up environment variables:
export AWS_ACCESS_KEY="your-access-key"
export AWS_SECRET_KEY="your-secret-key"
export AWS_REGION="us-east-1"
export BUCKET_NAME="your-bucket-name"Google Drive
- Create a Google Cloud Project
- Enable Google Drive API
- Download OAuth 2.0 credentials
- Save credentials as
google-drive-credentials.jsonin your project root
Quick Start
AWS S3 Setup
# Navigate to your project
cd your-project
# Initialize dorky with AWS
dorky --init aws
# List files that can be added
dorky --list
# Add sensitive files
dorky --add .env config.yml
# Push to S3
dorky --pushGoogle Drive Setup
# Navigate to your project
cd your-project
# Initialize dorky with Google Drive
dorky --init google-drive
# Authenticate (browser window will open)
# Follow the OAuth flow
# List files that can be added
dorky --list
# Add sensitive files
dorky --add .env secrets.json
# Push to Google Drive
dorky --pushUsage
Initialize a Project (-i)
# For AWS S3
dorky --init aws
# For Google Drive
dorky --init google-driveThis creates:
.dorky/folder with metadata and credentials.dorkyignorefile for exclusion patterns- Updates
.gitignoreto protect credentials
List Files (-l)
# List local files (shows what can be added)
dorky --list
# List remote files (shows what's in storage)
dorky --list remoteAdd Files to Stage (-a)
# Add single file
dorky --add .env
# Add multiple files
dorky --add .env config.yml secrets.json
# Add files with specific patterns
dorky --add .env.production .env.stagingRemove Files from Stage (-r)
# Remove single file
dorky --rm .env
# Remove multiple files
dorky --rm .env config.ymlPush Files to Storage (-ph)
# Push all staged files
dorky --pushThis command:
- Uploads new files
- Updates modified files (based on hash comparison)
- Removes files from remote storage that were unstaged using
dorky --rm - Skips unchanged files
Pull Files from Storage (-pl)
# Pull all tracked files
dorky --pullThis command:
- Downloads all tracked files from storage
- Creates necessary directories
- Overwrites local files
Destroy Project (-d)
# Destroy project locally and remotely
dorky --destroyThis command:
- Deletes all tracked files from remote storage
- Removes local
.dorky/directory and.dorkyignorefile - Warning: This action is irreversible for remote files.
Configuration
.dorkyignore
Exclude files and directories from dorky scanning:
node_modules/
.git/
dist/
build/
*.log
coverage/Directory Structure
After initialization:
your-project/
├── .dorky/
│ ├── credentials.json # Storage credentials (auto-ignored by git)
│ └── metadata.json # Tracked files metadata
├── .dorkyignore # Exclusion patterns
└── .gitignore # Updated automaticallyCommon Workflows
Workflow 1: Initial Setup for Team
# Team lead initializes and pushes files
dorky --init aws
dorky --add .env config/secrets.yml
dorky --push
# Team members pull files
git clone <repository>
cd <repository>
# Set up AWS credentials in environment
dorky --pullWorkflow 2: Update Sensitive Configuration
# Modify your .env file locally
vim .env
# Add updated file
dorky --add .env
# Push changes
dorky --pushWorkflow 3: Clean Up Tracked Files
# Remove from staging
dorky --rm old-config.yml
# Push to remove from remote
dorky --pushExamples
Example 1: Managing Environment Files
# Initialize with AWS
dorky --init aws
# Add environment files for different stages
dorky --add .env.development .env.staging .env.production
# Check what will be uploaded
dorky --list
# Upload to S3
dorky --push
# View remote files
dorky --list remoteExample 2: Managing API Keys
# Initialize with Google Drive
dorky --init google-drive
# Add API key files
dorky --add config/api-keys.json secrets/tokens.yml
# Push to Google Drive
dorky --push
# On another machine, pull the files
dorky --pullFeatures
- ✅ AWS S3 storage integration
- ✅ Google Drive storage integration
- ✅ List remote files in dorky bucket
- ✅ Auto detect .env and .config files
- ✅ Automatic .gitignore updates to ignore credentials
- ✅ Handle reauthentication for Google Drive
- ✅ Token refresh for Google Drive authentication
- ✅ Ignore dorky files in dorky itself
- ✅ File hash validation to skip unchanged files
- ✅ Mime-type detection for file uploads
- ✅ Recursive folder creation on pull
- ✅ Destroy project and clean up remote files
- ✅ Auto-recovery of AWS credentials from environment variables
How It Works
- Initialization: Creates
.dorky/folder with metadata and credentials - File Tracking: Maintains a hash-based registry of files in
metadata.json - Smart Uploads: Only uploads files that have changed (based on MD5 hash)
- Auto-detection: Highlights
.envand.configfiles during listing - Security: Automatically updates
.gitignoreto protect credentials
Security Best Practices
- ✅ Never commit
.dorky/credentials.jsonto version control - ✅ Use environment variables for AWS credentials
- ✅ Rotate access keys regularly
- ✅ Use IAM roles with minimal required permissions
- ✅ Review
.dorkyignorebefore adding files - ✅ Keep
google-drive-credentials.jsonsecure
Troubleshooting
AWS S3 Issues
Error: Missing credentials
# Set environment variables
export AWS_ACCESS_KEY="your-key"
export AWS_SECRET_KEY="your-secret"
export AWS_REGION="us-east-1"
export BUCKET_NAME="your-bucket"Google Drive Issues
Error: Invalid credentials
# Re-authenticate
dorky --init google-driveError: Token expired
- dorky automatically refreshes tokens
- If issues persist, delete
.dorky/credentials.jsonand re-authenticate
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
ISC License - see LICENSE file for details.
Support
Roadmap
- [x] Update README with AWS IAM policy (bug fix release)
- [x] Handle invalid access token for Google Drive and AWS (edge cases)
- [x] rm + push should delete file from remote storage (minor release)
- [x] Uninitialize dorky setup (Bug fix release)
- [ ] dorky --list remote --update should sync metadata according to remote (Minor release)
- [ ] Extension for VS Code to list and highlight them like git (Major release)
- [ ] MCP server (Minor release)
- [ ] Encryption of files (Minor release)
- [ ] Add stages for variables (Major release)
- [ ] Migrate dorky project to another storage (partially implemented)
- [ ] Add more test cases
- [ ] Deletion of files
- [ ] Edge cases for failure when credentials are invalid
- [ ] Add coverage reports badges
