mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-04 02:46:23 +00:00
wallabag, homepage changes portainer fixes
This commit is contained in:
@@ -42,11 +42,14 @@ def extract_overview(readme_path: Path, project_name: str) -> str:
|
||||
# ---------------------------------------------------------
|
||||
# Logo URL mapping with existence check
|
||||
# ---------------------------------------------------------
|
||||
def find_logo_url(dir_path: Path) -> str:
|
||||
def find_logo_url(dir_path: Path, nologo: bool = False) -> str:
|
||||
base_url = "https://i.4lt.ca/cookbooks/"
|
||||
name = dir_path.name
|
||||
logo_url = f"{base_url}{name}.png"
|
||||
|
||||
if nologo:
|
||||
return f"{base_url}default.png"
|
||||
|
||||
try:
|
||||
resp = requests.head(logo_url, timeout=5)
|
||||
if resp.status_code == 200:
|
||||
@@ -56,6 +59,7 @@ def find_logo_url(dir_path: Path) -> str:
|
||||
|
||||
return f"{base_url}default.png"
|
||||
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Parse image from docker-compose.yml using sample.env defaults
|
||||
# ---------------------------------------------------------
|
||||
@@ -184,7 +188,8 @@ def parse_env_vars(dir_path: Path):
|
||||
if "=" in line:
|
||||
key, value = line.split("=", 1)
|
||||
key = key.strip()
|
||||
value = value.strip().strip('"').strip("'")
|
||||
# Remove inline comment after #, then strip quotes and whitespace
|
||||
value = value.split("#", 1)[0].strip().strip('"').strip("'")
|
||||
if key:
|
||||
env_list.append({"name": key, "default": value})
|
||||
|
||||
@@ -200,7 +205,7 @@ def generate_template_object(dir_path: Path):
|
||||
|
||||
# Extract info
|
||||
description = extract_overview(readme_file, name)
|
||||
logo = find_logo_url(dir_path)
|
||||
logo = find_logo_url(dir_path, nologo=False) # for dev/test
|
||||
env_vars = parse_env_vars(dir_path)
|
||||
image = parse_image(compose_file, env_vars)
|
||||
ports = parse_ports(compose_file)
|
||||
|
||||
Reference in New Issue
Block a user