-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* expose manifest via endpoint/template * prefix env vars with XLWINGS_ * fix static dir * fix .env.template * handle more base_urls * implemented run.py init * templified the manifest further * use default manifest ids in all envs * fix run.py init * fix .env.template * reloed with .env changes * docs * docs and change default env to prod (.env sets it to dev) * docs * show env in tab name * more env related changes * added comment
- Loading branch information
Showing
13 changed files
with
179 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# Copy this file to .env: | ||
# cp .env.template .env | ||
|
||
ENVIRONMENT=development | ||
ENTRAID_TENANT_ID= | ||
ENTRAID_CLIENT_ID= | ||
# Get a free trial key from https://www.xlwings.org/trial | ||
XLWINGS_LICENSE_KEY=your-license-key | ||
XLWINGS_ENVIRONMENT=dev | ||
|
||
XLWINGS_ENTRAID_CLIENT_ID= | ||
XLWINGS_ENTRAID_TENANT_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import logging | ||
import os | ||
|
||
from fastapi import APIRouter, Request | ||
|
||
from ..config import settings | ||
from ..templates import TemplateResponse | ||
|
||
router = APIRouter() | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@router.get("/manifest") | ||
async def manifest(request: Request): | ||
if settings.hostname: | ||
# Settings | ||
base_url = f"https://{settings.hostname}" | ||
elif os.getenv("RENDER_EXTERNAL_URL"): | ||
# Render.com | ||
base_url = os.getenv("RENDER_EXTERNAL_URL") | ||
elif os.getenv("WEBSITE_HOSTNAME"): | ||
# Azure Functions and Azure App Service | ||
base_url = f"https://{os.getenv('WEBSITE_HOSTNAME')}" | ||
elif os.getenv("CODESPACES"): | ||
# GitHub Codespaces | ||
base_url = f"https://{os.getenv('CODESPACE_NAME')}-8000.{os.getenv('GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN')}" | ||
else: | ||
# Mostly localhost | ||
base_url = request.base_url | ||
|
||
manifest_ids = { | ||
"dev": settings.manifest_id_dev, | ||
"qa": settings.manifest_id_qa, | ||
"uat": settings.manifest_id_uat, | ||
"prod": settings.manifest_id_prod, | ||
} | ||
manifest_id = manifest_ids[settings.environment] | ||
|
||
return TemplateResponse( | ||
request=request, | ||
name="/manifest.xml", | ||
context={ | ||
"settings": settings, | ||
"base_url": str(base_url).rstrip("/"), | ||
"manifest_id": manifest_id, | ||
}, | ||
media_type="text/plain", | ||
) |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.