Small changes

main
Sam Hatfield 1 year ago
parent 37557e867b
commit e5d1885af4

@ -1,3 +1,14 @@
# Personal Effectivity Application, aka PEA V1
This is an app I'm building in Python and React.js
## Environment Variables
### PEA API settings
`PEA_API_ACCESS_TOKEN_EXPIRE_MINUTES`, how many minutes that access tokens last
`PEA_API_ALGORITHM`, defaulted to "HS256"
`PEA_API_CORS_ORIGINS`, list of origins allowed
`PEA_API_DB_HOSTNAME`, hostname of database
`PEA_API_DB_PASSWORD`, password of database
`PEA_API_DB_USERNAME`, username of database
`PEA_API_SECRET_KEY`, secret key for encoding access tokens

@ -1,5 +1,3 @@
use nix
dotenv ../.env
layout python

@ -1,4 +0,0 @@
.PHONY: clean
clean:
if [ -L "result" ]; then rm result; fi
if [ -d "dist" ]; then rm -fr dist; fi

@ -1 +0,0 @@
{ mach-nix ? import ./mach.nix, ... }: mach-nix.mkPython [ ./. ]

@ -1,4 +0,0 @@
import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix";
ref = "refs/tags/3.4.0";
}) {}

@ -1,2 +0,0 @@
{ mach-nix ? import ./mach.nix, ... }:
mach-nix.mkPythonShell [ ./. ]

@ -1,7 +1,4 @@
from datetime import datetime, timedelta
from os import environ
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.ext.asyncio import AsyncSession
@ -25,9 +22,9 @@ async def login_for_access_token(
detail="Incorrect email or password",
headers={"WWW-Authenticate": "Bearer"},
)
access_token_expires = timedelta(minutes=settings.access_token_expire_minutes)
access_token_expiry = timedelta(minutes=settings.access_token_expire_minutes)
access_token = crud.create_access_token(
data={"sub": user.username}, expires_delta=access_token_expires
data={"sub": user.username}, expires_delta=access_token_expiry
)
return models.Token(access_token=access_token, token_type="bearer")

@ -1,6 +1,5 @@
import os
from dotenv import load_dotenv
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Table, Text, text
from sqlalchemy.orm import relationship

@ -24,9 +24,9 @@ target_metadata = Base.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:
section = config.config_ini_section
config.set_section_option(section, "DB_USER", os.environ.get("PEA_DB_USERNAME"))
config.set_section_option(section, "DB_PASS", os.environ.get("PEA_DB_PASSWORD"))
config.set_section_option(section, "DB_HOST", os.environ.get("PEA_DB_HOSTNAME"))
config.set_section_option(section, "DB_USER", os.environ.get("PEA_API_DB_USERNAME"))
config.set_section_option(section, "DB_PASS", os.environ.get("PEA_API_DB_PASSWORD"))
config.set_section_option(section, "DB_HOST", os.environ.get("PEA_API_DB_HOSTNAME"))
def run_migrations_offline():

@ -13,7 +13,7 @@ class Settings(BaseSettings):
secret_key: str
class Config:
env_prefix = "PEA_"
env_prefix = "PEA_API_"
settings = Settings()

Loading…
Cancel
Save