refactor(demo): split UI service package
This commit is contained in:
@@ -21,6 +21,6 @@ DEMO_ENABLE_DEBUG_OTP=true
|
||||
DEMO_DEBUG_SMS_TTL_SECONDS=300
|
||||
DEMO_HOST=0.0.0.0
|
||||
DEMO_PORT=8080
|
||||
ADMIN_MOBILE=989120000000
|
||||
ADMIN_MOBILE=09120000000
|
||||
GRPC_HOST=0.0.0.0
|
||||
GRPC_PORT=50051
|
||||
|
||||
@@ -35,7 +35,7 @@ Supported values:
|
||||
|
||||
## Demo UI
|
||||
|
||||
`demo-app` is a small FastAPI backend-for-frontend that calls `auth-service` over gRPC. It demonstrates how another microservice consumes the auth service.
|
||||
`demo-app` is a small FastAPI backend-for-frontend, implemented as the sibling package `gapido_demo`, that calls `auth-service` over gRPC. It demonstrates how another microservice consumes the auth service.
|
||||
|
||||
Available browser actions:
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ services:
|
||||
|
||||
demo-app:
|
||||
build: .
|
||||
command: uvicorn gapido_auth.demo.app:app --host 0.0.0.0 --port 8080
|
||||
command: uvicorn gapido_demo.app:app --host 0.0.0.0 --port 8080
|
||||
environment:
|
||||
AUTH_GRPC_TARGET: auth-service:50051
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
|
||||
@@ -35,6 +35,9 @@ build-backend = "setuptools.build_meta"
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
gapido_demo = ["static/*"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
asyncio_default_fixture_loop_scope = "function"
|
||||
@@ -52,7 +55,7 @@ select = ["E", "F", "I", "B", "UP", "ASYNC"]
|
||||
[tool.mypy]
|
||||
python_version = "3.12"
|
||||
strict = true
|
||||
packages = ["gapido_auth"]
|
||||
packages = ["gapido_auth", "gapido_demo"]
|
||||
exclude = ["src/gapido_auth/generated"]
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
"""Demo browser client for the auth service."""
|
||||
|
||||
1
src/gapido_demo/__init__.py
Normal file
1
src/gapido_demo/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Demo browser client service for Gapido Auth."""
|
||||
@@ -12,8 +12,8 @@ from pydantic import BaseModel, Field
|
||||
from redis.asyncio import Redis
|
||||
|
||||
from gapido_auth.config import Settings, get_settings
|
||||
from gapido_auth.demo.grpc_client import AuthGrpcClient, DemoTokenResponse
|
||||
from gapido_auth.infrastructure.debug_sms_client import debug_sms_key
|
||||
from gapido_demo.grpc_client import AuthGrpcClient, DemoTokenResponse
|
||||
|
||||
STATIC_DIR = Path(__file__).resolve().parent / "static"
|
||||
T = TypeVar("T")
|
||||
1
src/gapido_demo/py.typed
Normal file
1
src/gapido_demo/py.typed
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -136,4 +136,3 @@ $("admin").addEventListener("click", async () => {
|
||||
});
|
||||
|
||||
render();
|
||||
|
||||
@@ -62,4 +62,3 @@
|
||||
<script src="/static/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
:root {
|
||||
color-scheme: light;
|
||||
color-scheme: dark;
|
||||
font-family:
|
||||
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
background: #f5f7fb;
|
||||
color: #1d2433;
|
||||
background: #0c111d;
|
||||
color: #e6edf7;
|
||||
}
|
||||
|
||||
* {
|
||||
@@ -27,11 +27,11 @@ input {
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: #ffffff;
|
||||
border: 1px solid #dbe3ef;
|
||||
background: #121a2a;
|
||||
border: 1px solid #243149;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 16px 45px rgb(29 36 51 / 8%);
|
||||
box-shadow: 0 18px 55px rgb(0 0 0 / 28%);
|
||||
}
|
||||
|
||||
.identity {
|
||||
@@ -44,7 +44,7 @@ input {
|
||||
.eyebrow {
|
||||
margin: 0 0 4px;
|
||||
font-size: 13px;
|
||||
color: #5f6f89;
|
||||
color: #8fa3c1;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ h2 {
|
||||
}
|
||||
|
||||
.status {
|
||||
border: 1px solid #c4d3ea;
|
||||
border: 1px solid #2e7d72;
|
||||
border-radius: 999px;
|
||||
padding: 8px 12px;
|
||||
color: #315477;
|
||||
background: #eef5ff;
|
||||
color: #8ff0d2;
|
||||
background: #0f2a28;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@@ -85,32 +85,32 @@ h2 {
|
||||
label {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
color: #40516b;
|
||||
color: #b7c6dd;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
border: 1px solid #cfd9e8;
|
||||
border: 1px solid #2b3a55;
|
||||
border-radius: 6px;
|
||||
padding: 11px 12px;
|
||||
color: #1d2433;
|
||||
background: #fbfdff;
|
||||
color: #e6edf7;
|
||||
background: #0b1220;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
padding: 11px 14px;
|
||||
background: #206a5d;
|
||||
background: #2d8f7e;
|
||||
color: #ffffff;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #18544a;
|
||||
background: #247669;
|
||||
}
|
||||
|
||||
.actions {
|
||||
@@ -132,7 +132,7 @@ button:hover {
|
||||
}
|
||||
|
||||
dt {
|
||||
color: #6b7b92;
|
||||
color: #93a4bc;
|
||||
}
|
||||
|
||||
dd {
|
||||
@@ -146,8 +146,9 @@ pre {
|
||||
padding: 14px;
|
||||
border-radius: 6px;
|
||||
overflow: auto;
|
||||
background: #111827;
|
||||
color: #d1fae5;
|
||||
border: 1px solid #243149;
|
||||
background: #080d16;
|
||||
color: #a7f3d0;
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
@@ -161,4 +162,3 @@ pre {
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ from dataclasses import dataclass
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from gapido_auth.config import Settings
|
||||
from gapido_auth.demo.app import app, get_app_settings, get_auth_client, get_debug_redis
|
||||
from gapido_auth.demo.grpc_client import DemoTokenResponse
|
||||
from gapido_demo.app import app, get_app_settings, get_auth_client, get_debug_redis
|
||||
from gapido_demo.grpc_client import DemoTokenResponse
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
|
||||
Reference in New Issue
Block a user