init
Initialize new kiln projects with encryption keys and configuration files.
Synopsis
Section titled “Synopsis”kiln init key [options]kiln init config [options]The init command provides two subcommands for setting up kiln projects:
key- Generate age encryption key pairsconfig- Create configuration files with recipients and access control
Subcommands
Section titled “Subcommands”init key
Section titled “init key”Generate a new age encryption key pair for secure environment variable management.
kiln init key [--path <path>] [--encrypt] [--force]Options
Section titled “Options”--path <path>: Key file location (default:~/.kiln/kiln.key)--encrypt: Protect private key with passphrase--force: Overwrite existing key files
Examples
Section titled “Examples”Generate a new key pair:
kiln init keyGenerate with custom path:
kiln init key --path ./keys/production.keyGenerate with passphrase protection:
kiln init key --encryptOutput
Section titled “Output”The command creates two files:
- Private key:
<path>(mode 0600) - Public key:
<path>.pub(mode 0600)
The public key is displayed and should be shared with team members who need to add you as a recipient.
init config
Section titled “init config”Create a new kiln configuration file with recipients and file definitions.
kiln init config [--path <path>] [--recipients name=key] [--force]Options
Section titled “Options”--path <path>: Configuration file location (default:kiln.toml)--recipients name=key: Named recipients inname=public-keyformat--force: Overwrite existing configuration
Examples
Section titled “Examples”Create configuration with recipients:
kiln init config --recipients "alice=age1234...abcd" --recipients "bob=ssh-ed25519 AAAAC3..."Create with custom path:
kiln init config --path ./deploy/kiln.tomlRecipients Format
Section titled “Recipients Format”Recipients can be specified in two formats:
Age public keys:
--recipients "alice=age1234567890abcdef..."SSH public keys:
--recipients "bob=ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGb..."From file:
--recipients "charlie=~/.ssh/id_ed25519.pub"Generated Configuration
Section titled “Generated Configuration”The command creates a kiln.toml file with:
[recipients]alice = "age1234567890abcdef..."bob = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGb..."
[files][files.default]filename = ".kiln.env"access = ["*"]Configuration files contain only public keys and can be safely committed to version control.
Common Workflows
Section titled “Common Workflows”Individual Setup
Section titled “Individual Setup”# Generate personal keykiln init key
# Create configuration with your public keykiln init config --recipients "$(whoami)=$(cat ~/.kiln/kiln.key.pub)"Team Setup
Section titled “Team Setup”# Team lead generates shared configurationkiln init config \ --recipients "alice=age1234...abcd" \ --recipients "bob=ssh-ed25519 AAAAC3..." \ --recipients "charlie=~/.ssh/id_ed25519.pub"Production Setup
Section titled “Production Setup”# Generate production key with passphrasekiln init key --path ./keys/prod.key --encrypt
# Create restricted configurationkiln init config --path ./prod-kiln.toml \ --recipients "admin=$(cat ./keys/prod.key.pub)"Error Handling
Section titled “Error Handling”The init command validates all inputs and provides clear error messages:
- Key exists: Use
--forceto overwrite existing keys - Invalid path: Path must be accessible and writable
- Invalid public key: Public key format must be valid age or SSH key
- Permission denied: Directory must be writable
Integration
Section titled “Integration”CI/CD Pipelines
Section titled “CI/CD Pipelines”# Generate ephemeral keys for CIkiln init key --path /tmp/ci.key
# Use existing keys in configurationkiln init config --recipients "ci=$(cat /tmp/ci.key.pub)"Team Onboarding
Section titled “Team Onboarding”# New team member shares their public keykiln init config --recipients "newmember=age1new...member"
# Or use their SSH keykiln init config --recipients "newmember=$(curl -s https://github.com/username.keys)"Best Practices
Section titled “Best Practices”- Use descriptive recipient names that match team member identities
- Store private keys securely with appropriate file permissions
- Use passphrase encryption for production and shared environments
- Version control configuration files but never private keys
- Document key locations and backup procedures for your team