48 lines
1.0 KiB
Python
48 lines
1.0 KiB
Python
"""GitOps integration commands for env-pro."""
|
|
|
|
import click
|
|
|
|
|
|
@click.command()
|
|
def gitignore():
|
|
"""Generate .gitignore entries for env-pro files."""
|
|
entries = """# env-pro environment profiles
|
|
.env-profiles/
|
|
!.env-profiles/.gitkeep
|
|
.env.schema.yaml
|
|
|
|
# Encrypted files
|
|
*.encrypted
|
|
*.age
|
|
|
|
# Environment files (add your specific files)
|
|
.env.local
|
|
.env.*.local
|
|
"""
|
|
click.echo(entries)
|
|
|
|
|
|
@click.command()
|
|
@click.option("--sops/--no-sops", default=False)
|
|
def sops(sops: bool):
|
|
"""Show SOPS integration information."""
|
|
if sops:
|
|
info = """# SOPS Integration
|
|
|
|
To use SOPS for encrypted secrets:
|
|
|
|
1. Install SOPS: https://github.com/mozilla/sops
|
|
2. Create an age key: age-keygen -o key.txt
|
|
3. Add public key to .sops.yaml:
|
|
|
|
creation_rules:
|
|
- path_regex: .env-profiles/.*
|
|
age: <your-public-key>
|
|
|
|
4. Encrypt files: sops -e .env-profiles/prod/.env > .env-profiles/prod/.env.enc
|
|
5. Update .gitignore to include .env.enc files
|
|
"""
|
|
click.echo(info)
|
|
else:
|
|
click.echo("Use 'env-pro sops --sops' to see SOPS integration guide")
|