Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions linodecli/plugins/obj/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
The config of the object storage plugin.
"""

import os
import re
import shutil

ENV_ACCESS_KEY_NAME = "LINODE_CLI_OBJ_ACCESS_KEY"
ENV_SECRET_KEY_NAME = "LINODE_CLI_OBJ_SECRET_KEY"
# replace {} with the cluster name
BASE_URL_TEMPLATE = "https://{}.linodeobjects.com"
BASE_WEBSITE_TEMPLATE = "{bucket}.website-{cluster}.linodeobjects.com"

API_HOST = os.getenv("LINODE_CLI_API_HOST", "")

OBJ_DOMAIN = "linodeobjects.com"

if API_HOST:
match = re.match(r"api\.([^.]+)\.linode\.com", API_HOST)
if match:
OBJ_DOMAIN = f"{match.group(1)}.linodeobjects.com"

BASE_URL_TEMPLATE = f"https://{{}}.{OBJ_DOMAIN}"
BASE_WEBSITE_TEMPLATE = f"{{bucket}}.website-{{cluster}}.{OBJ_DOMAIN}"

# for all date output
DATE_FORMAT = "%Y-%m-%d %H:%M"
Expand Down