Skip to content

Commit

Permalink
5.7.7 - default app and redirect tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Oct 23, 2024
1 parent b53c9d2 commit 6a9a6e3
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- run: |
mk python-release owner=vkottler \
repo=runtimepy version=5.7.6
repo=runtimepy version=5.7.7
if: |
matrix.python-version == '3.12'
&& matrix.system == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.1.4
hash=41ff8742602f69f2831092a4b666cddc
hash=0bf47d2ff3fb0ed78ed013f4fcbc59e2
=====================================
-->

# runtimepy ([5.7.6](https://pypi.org/project/runtimepy/))
# runtimepy ([5.7.7](https://pypi.org/project/runtimepy/))

[![python](https://img.shields.io/pypi/pyversions/runtimepy.svg)](https://pypi.org/project/runtimepy/)
![Build Status](https://github.com/vkottler/runtimepy/workflows/Python%20Package/badge.svg)
Expand Down
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 5
minor: 7
patch: 6
patch: 7
entry: runtimepy
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "runtimepy"
version = "5.7.6"
version = "5.7.7"
description = "A framework for implementing Python services."
readme = "README.md"
requires-python = ">=3.11"
Expand Down
4 changes: 2 additions & 2 deletions runtimepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.4
# hash=cab7cff2cb194a61178fa386b80eae85
# hash=ed12f307211d1317e3ce6a7c4409b97f
# =====================================

"""
Expand All @@ -10,7 +10,7 @@

DESCRIPTION = "A framework for implementing Python services."
PKG_NAME = "runtimepy"
VERSION = "5.7.6"
VERSION = "5.7.7"

# runtimepy-specific content.
METRICS_NAME = "metrics"
Expand Down
5 changes: 4 additions & 1 deletion runtimepy/data/server_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ init:
config:
# Default redirects.
http_redirects:
"/": "/app.html"
"/": "/index.html"
"/index.html": "/app.html"

# Serve these applications by default at these paths.
http_app_paths: ["/", "/app.html", "/index.html"]

servers:
- factory: runtimepy_http
kwargs: {port: "$runtimepy_http_server"}
Expand Down
2 changes: 1 addition & 1 deletion runtimepy/net/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ async def get_handler(
return self.favicon_data

# Try serving a file and handling redirects.
for handler in [self.try_redirect, self.try_file]:
for handler in [self.try_file, self.try_redirect]:
result = await handler(
request.target.origin_form, response
)
Expand Down
7 changes: 4 additions & 3 deletions runtimepy/net/server/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ async def setup(app: AppInfo) -> int:
)

# Default application (environment tabs).
RuntimepyServerConnection.apps["/app.html"] = create_app(
app, getattr(_import_module(module), method)
)
html_app = create_app(app, getattr(_import_module(module), method))
target: str
for target in app.config_param("http_app_paths", []):
RuntimepyServerConnection.apps[target] = html_app

# Register redirects.
redirects: dict[str, str] = app.config_param("http_redirects", {})
Expand Down

0 comments on commit 6a9a6e3

Please sign in to comment.