mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
add jwt to config.py
This commit is contained in:
parent
174a1add0b
commit
97c7a3c206
2
.env
2
.env
@ -7,3 +7,5 @@ SQL_HOST=db
|
|||||||
SQL_USER=user
|
SQL_USER=user
|
||||||
SQL_PASS=secret
|
SQL_PASS=secret
|
||||||
|
|
||||||
|
ALGORITHM=HS256
|
||||||
|
ACCESS_TOKEN_EXPIRE_MINUTES=30
|
||||||
|
5
Makefile
5
Makefile
@ -31,9 +31,12 @@ safety: ## Check project and dependencies with safety https://github.com/pyupio/
|
|||||||
docker-compose run --rm app safety check
|
docker-compose run --rm app safety check
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: ## Linte project code.
|
lint: ## Lint project code.
|
||||||
isort .
|
isort .
|
||||||
black --fast --line-length=120 .
|
black --fast --line-length=120 .
|
||||||
mypy --ignore-missing-imports the_app
|
mypy --ignore-missing-imports the_app
|
||||||
flake8 --config .flake8 .
|
flake8 --config .flake8 .
|
||||||
|
|
||||||
|
.PHONY: secret
|
||||||
|
secret: ## Generate random secret.
|
||||||
|
openssl rand -hex 32
|
||||||
|
1
Pipfile
1
Pipfile
@ -18,6 +18,7 @@ sqlalchemy = "*"
|
|||||||
pytest-asyncio = "*"
|
pytest-asyncio = "*"
|
||||||
pytest-cov = "*"
|
pytest-cov = "*"
|
||||||
python-jose = {extras = ["cryptography"], version = "*"}
|
python-jose = {extras = ["cryptography"], version = "*"}
|
||||||
|
passlib = {extras = ["bcrypt"], version = "*"}
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
icecream = "*"
|
icecream = "*"
|
||||||
|
25
Pipfile.lock
generated
25
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "3335e2946336154720339ea7bccc5516814debc3168eee03ba6918d7e9d0e685"
|
"sha256": "86d6d53f88f48a5b54981346f5454046d18bafd4f7d28fa7ec722657d09f2c02"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -68,6 +68,18 @@
|
|||||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
|
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
|
||||||
"version": "==21.2.0"
|
"version": "==21.2.0"
|
||||||
},
|
},
|
||||||
|
"bcrypt": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:5b93c1726e50a93a033c36e5ca7fdcd29a5c7395af50a6892f5d9e7c6cfbfb29",
|
||||||
|
"sha256:63d4e3ff96188e5898779b6057878fecf3f11cfe6ec3b313ea09955d587ec7a7",
|
||||||
|
"sha256:81fec756feff5b6818ea7ab031205e1d323d8943d237303baca2c5f9c7846f34",
|
||||||
|
"sha256:a67fb841b35c28a59cebed05fbd3e80eea26e6d75851f0574a9273c80f3e9b55",
|
||||||
|
"sha256:c95d4cbebffafcdd28bd28bb4e25b31c50f6da605c81ffd9ad8a3d1b2ab7b1b6",
|
||||||
|
"sha256:cd1ea2ff3038509ea95f687256c46b79f5fc382ad0aa3664d200047546d511d1",
|
||||||
|
"sha256:cdcdcb3972027f83fe24a48b1e90ea4b584d35f1cc279d76de6fc4b13376239d"
|
||||||
|
],
|
||||||
|
"version": "==3.2.0"
|
||||||
|
},
|
||||||
"black": {
|
"black": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:dc132348a88d103016726fe360cb9ede02cecf99b76e3660ce6c596be132ce04",
|
"sha256:dc132348a88d103016726fe360cb9ede02cecf99b76e3660ce6c596be132ce04",
|
||||||
@ -432,6 +444,17 @@
|
|||||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||||
"version": "==20.9"
|
"version": "==20.9"
|
||||||
},
|
},
|
||||||
|
"passlib": {
|
||||||
|
"extras": [
|
||||||
|
"bcrypt"
|
||||||
|
],
|
||||||
|
"hashes": [
|
||||||
|
"sha256:aa6bca462b8d8bda89c70b382f0c298a20b5560af6cbfa2dce410c0a2fb669f1",
|
||||||
|
"sha256:defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.7.4"
|
||||||
|
},
|
||||||
"pathspec": {
|
"pathspec": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd",
|
"sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd",
|
||||||
|
@ -34,6 +34,10 @@ class Settings(BaseSettings):
|
|||||||
asyncpg_url: str = f"postgresql+asyncpg://{pg_user}:{pg_pass}@{pg_host}:5432/{pg_database}"
|
asyncpg_url: str = f"postgresql+asyncpg://{pg_user}:{pg_pass}@{pg_host}:5432/{pg_database}"
|
||||||
asyncpg_test_url: str = f"postgresql+asyncpg://{pg_user}:{pg_pass}@{pg_host}:5432/{pg_test_database}"
|
asyncpg_test_url: str = f"postgresql+asyncpg://{pg_user}:{pg_pass}@{pg_host}:5432/{pg_test_database}"
|
||||||
|
|
||||||
|
jwt_secret_key: str = os.getenv("SECRET_KEY", "")
|
||||||
|
jwt_algorithm: str = os.getenv("ALGORITHM", "")
|
||||||
|
jwt_access_toke_expire_minutes: int = os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", 1)
|
||||||
|
|
||||||
|
|
||||||
@lru_cache()
|
@lru_cache()
|
||||||
def get_settings():
|
def get_settings():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user