Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
65137b99ac | |||
7f36eafc11 | |||
fc77407379 |
4 changed files with 7 additions and 3 deletions
|
@ -51,6 +51,7 @@ Available configuration options:
|
||||||
--uds TEXT Bind to a UNIX domain socket.
|
--uds TEXT Bind to a UNIX domain socket.
|
||||||
--workers INTEGER Number of worker processes. Defaults to the
|
--workers INTEGER Number of worker processes. Defaults to the
|
||||||
$WEB_CONCURRENCY environment variable if available, or 1.
|
$WEB_CONCURRENCY environment variable if available, or 1.
|
||||||
|
--version Show the version and exit.
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from importlib.metadata import version
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
|
@ -21,5 +23,6 @@ import uvicorn
|
||||||
),
|
),
|
||||||
type=int,
|
type=int,
|
||||||
)
|
)
|
||||||
|
@click.version_option(version("pssecret_server"))
|
||||||
def cli(**kwargs) -> None:
|
def cli(**kwargs) -> None:
|
||||||
uvicorn.run("pssecret_server.main:app", **kwargs)
|
uvicorn.run("pssecret_server.main:app", **kwargs)
|
||||||
|
|
|
@ -8,7 +8,7 @@ from redis.asyncio import Redis
|
||||||
from pssecret_server.fernet import get_fernet
|
from pssecret_server.fernet import get_fernet
|
||||||
from pssecret_server.models import Secret, SecretSaveResult
|
from pssecret_server.models import Secret, SecretSaveResult
|
||||||
from pssecret_server.redis_db import get_redis
|
from pssecret_server.redis_db import get_redis
|
||||||
from pssecret_server.utils import decrypt_secret, encrypt_secret, save_secret
|
from pssecret_server.utils import decrypt_secret, encrypt_secret, getdel, save_secret
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ async def set_secret(
|
||||||
async def get_secret(
|
async def get_secret(
|
||||||
secret_key: str, redis: RedisDep, fernet: FernetDep
|
secret_key: str, redis: RedisDep, fernet: FernetDep
|
||||||
) -> dict[str, bytes]:
|
) -> dict[str, bytes]:
|
||||||
data: bytes | None = await redis.getdel(secret_key)
|
data: bytes | None = await getdel(redis, secret_key)
|
||||||
|
|
||||||
if data is None:
|
if data is None:
|
||||||
raise HTTPException(404)
|
raise HTTPException(404)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pssecret-server"
|
name = "pssecret-server"
|
||||||
version = "1.1.0"
|
version = "1.1.2"
|
||||||
description = "API service for secrets sharing over network"
|
description = "API service for secrets sharing over network"
|
||||||
authors = ["Ivan Golikov <root@ivnglkv.me>"]
|
authors = ["Ivan Golikov <root@ivnglkv.me>"]
|
||||||
license = "BSD-3-Clause"
|
license = "BSD-3-Clause"
|
||||||
|
|
Loading…
Reference in a new issue