feat(config): load repo-root .env via python-dotenv
All checks were successful
python-syntax / syntax-check (push) Successful in 4s
All checks were successful
python-syntax / syntax-check (push) Successful in 4s
This commit is contained in:
9
.env.example
Normal file
9
.env.example
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Copy to .env and adjust as needed
|
||||||
|
|
||||||
|
CLICKTHROUGH_HOST=127.0.0.1
|
||||||
|
CLICKTHROUGH_PORT=8123
|
||||||
|
CLICKTHROUGH_TOKEN=change-me
|
||||||
|
CLICKTHROUGH_DRY_RUN=false
|
||||||
|
CLICKTHROUGH_GRID_ROWS=12
|
||||||
|
CLICKTHROUGH_GRID_COLS=12
|
||||||
|
# CLICKTHROUGH_ALLOWED_REGION=0,0,1920,1080
|
||||||
@@ -22,6 +22,8 @@ CLICKTHROUGH_TOKEN=change-me python -m server.app
|
|||||||
|
|
||||||
Server defaults to `127.0.0.1:8123`.
|
Server defaults to `127.0.0.1:8123`.
|
||||||
|
|
||||||
|
`python-dotenv` is enabled, so values from a repo-root `.env` file are loaded automatically.
|
||||||
|
|
||||||
## Minimal API flow
|
## Minimal API flow
|
||||||
|
|
||||||
1. `GET /screen` with grid
|
1. `GET /screen` with grid
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
fastapi>=0.115.0
|
fastapi>=0.115.0
|
||||||
uvicorn>=0.30.0
|
uvicorn>=0.30.0
|
||||||
|
python-dotenv>=1.0.1
|
||||||
mss>=9.0.1
|
mss>=9.0.1
|
||||||
pillow>=10.4.0
|
pillow>=10.4.0
|
||||||
pyautogui>=0.9.54
|
pyautogui>=0.9.54
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ import time
|
|||||||
import uuid
|
import uuid
|
||||||
from typing import Literal, Optional
|
from typing import Literal, Optional
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
from fastapi import Depends, FastAPI, Header, HTTPException, Response
|
from fastapi import Depends, FastAPI, Header, HTTPException, Response
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, model_validator
|
||||||
|
|
||||||
|
|
||||||
|
load_dotenv(dotenv_path=".env", override=False)
|
||||||
|
|
||||||
app = FastAPI(title="clickthrough", version="0.1.0")
|
app = FastAPI(title="clickthrough", version="0.1.0")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user