Add env_pro command modules
This commit is contained in:
47
app/env_pro/commands/gitignore_cmd.py
Normal file
47
app/env_pro/commands/gitignore_cmd.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""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")
|
||||
Reference in New Issue
Block a user