I think Heroku can still write to local files during the lifecycle of the app. So as part of your app initialisation, before you invoke pyodk, grab the environment variables and put them into files. e.g.
import os
# Retrieve environment variables
base_url = os.getenv("CENTRAL_BASE_URL", "https://www.example.com")
username = os.getenv("CENTRAL_USERNAME", "my_user")
password = os.getenv("CENTRAL_PASSWORD", "my_password")
default_project_id = os.getenv("CENTRAL_DEFAULT_PROJECT_ID", "123")
# Define the file content
file_content = f"""[central]
base_url = "{base_url}"
username = "{username}"
password = "{password}"
default_project_id = {default_project_id}
"""
# Define a writable path (/app/tmp is a writable directory on Heroku)
file_path = "/app/tmp/pyodk_config.ini"
# Create the directory if it doesn't exist
os.makedirs(os.path.dirname(file_path), exist_ok=True)
# Write the configuration to the file
with open(file_path, "w") as file:
file.write(file_content)
Then use it:
from pyodk import Client
client = Client(config_path="/app/tmp/pyodk_config.ini", cache_path="/app/tmp/pyodk_cache.ini")
There might be better support for this sort of thing once this issue is addressed.