Skip to content

Instantly share code, notes, and snippets.

View deej81's full-sized avatar

Dan Jordan deej81

  • WeThinkCode_
  • Yorkshire,UK
  • X @deej99
View GitHub Profile
@deej81
deej81 / generate-env-template.py
Last active September 7, 2023 13:21
Create a template .env file from a docker-compose.yml file
import re
def extract_env_vars_from_docker_compose(compose_file_path):
with open(compose_file_path, 'r') as file:
content = file.read()
return set(re.findall(r'\$\{(\w+)\}', content))
def load_existing_env_vars(env_file_path=".env"):
env_vars = {}
try: