fix: have uvicorn use Settings.port and Settings.host

This commit is contained in:
cătălin 2025-03-06 19:44:44 +01:00
commit 95101a6573
No known key found for this signature in database
8 changed files with 28 additions and 7 deletions

View file

@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [unreleased]
### 🐛 Bug Fixes
- Have uvicorn use Settings.port and Settings.host
## [0.3.2] - 2025-03-06
### ⚙️ Miscellaneous Tasks
- Update charts to v0.3.2
## [0.3.1] - 2025-03-06 ## [0.3.1] - 2025-03-06
### 🐛 Bug Fixes ### 🐛 Bug Fixes

View file

@ -16,7 +16,7 @@ ENV PYTHONPATH="$APP_PATH"
ENV PATH="$APP_HOME/.local/bin:$PATH" ENV PATH="$APP_HOME/.local/bin:$PATH"
# hadolint ignore=DL3001,DL3008,DL3018 # hadolint ignore=DL3001,DL3008,DL3018
RUN apk add --no-cache make python3~=3.12 \ RUN apk add --no-cache make python3~=3.12 curl \
&& adduser -S -u "$USERID" -h "$APP_HOME" "$USERNAME" \ && adduser -S -u "$USERID" -h "$APP_HOME" "$USERNAME" \
&& mkdir -p "$APP_PATH" \ && mkdir -p "$APP_PATH" \
&& chown -R "$USERID:$GROUPID" "$APP_PATH" && chown -R "$USERID:$GROUPID" "$APP_PATH"
@ -40,6 +40,7 @@ FROM base AS serve
CMD ["make", "serve"] CMD ["make", "serve"]
FROM base AS migrate FROM base AS migrate
CMD ["make", "migrate"] CMD ["make", "migrate"]

View file

@ -19,7 +19,7 @@ tests:
uv run coverage xml uv run coverage xml
serve: serve:
uv run uvicorn src.apps.httpapi.litestar.main:app uv run python src/apps/httpapi/litestar/main.py
build: build:
docker build . -t git.roboces.dev/catalin/$(PROJECT_NAME):$(PROJECT_TAG) --target $(PROJECT_TARGET) docker build . -t git.roboces.dev/catalin/$(PROJECT_NAME):$(PROJECT_TAG) --target $(PROJECT_TARGET)

View file

@ -1,6 +1,6 @@
apiVersion: v2 apiVersion: v2
appVersion: 0.3.2 appVersion: 0.3.3
description: A Helm chart for Kubernetes description: A Helm chart for Kubernetes
name: huesoporro name: huesoporro
type: application type: application
version: 0.3.2 version: 0.3.3

View file

@ -8,7 +8,7 @@ fullnameOverride: ''
image: image:
pullPolicy: Always pullPolicy: Always
repository: git.roboces.dev/catalin/huesoporro repository: git.roboces.dev/catalin/huesoporro
tag: 0.3.2 tag: 0.3.3
imagePullSecrets: [] imagePullSecrets: []
ingress: ingress:
annotations: {} annotations: {}

View file

@ -1,6 +1,6 @@
[project] [project]
name = "huesoporro" name = "huesoporro"
version = "0.3.2" version = "0.3.3"
description = "Misc Twitch bot" description = "Misc Twitch bot"
readme = "README.md" readme = "README.md"
authors = [ authors = [

View file

@ -1,4 +1,5 @@
import httpx import httpx
import uvicorn
from litestar import Litestar, get from litestar import Litestar, get
from litestar.contrib.jinja import JinjaTemplateEngine from litestar.contrib.jinja import JinjaTemplateEngine
from litestar.di import Provide from litestar.di import Provide
@ -113,3 +114,10 @@ def create_app():
app = create_app() app = create_app()
if __name__ == "__main__":
s = Settings.get()
config = uvicorn.Config("main:app", host=s.port, port=s.port, log_level="info")
server = uvicorn.Server(config)
server.run()

2
uv.lock generated
View file

@ -517,7 +517,7 @@ wheels = [
[[package]] [[package]]
name = "huesoporro" name = "huesoporro"
version = "0.3.0" version = "0.3.3"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "aiosqlite" }, { name = "aiosqlite" },