Renamed project to pssecret-server

This commit is contained in:
Ivan Golikov 2025-01-01 20:01:10 +01:00
parent 8266c95cd9
commit 05ba1aa6f1
14 changed files with 23 additions and 24 deletions

3
.gitignore vendored
View file

@ -1,9 +1,8 @@
.*env
.idea/
.nvim.lua
.pytest_cache/
.python-version
.venv/
__pycache__/
build/
dist/
pssecret.egg-info/

View file

@ -1,8 +1,8 @@
# Installation
```console
$ git clone git@git.ivnglkv.me:root/pssecret.git
$ cd pssecret
$ git clone git@git.ivnglkv.me:root/pssecret-server.git
$ cd pssecret-server
$ poetry install --with=dev
```

View file

@ -1,4 +1,4 @@
# Pssecret
# Pssecret server
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
@ -23,24 +23,24 @@ Service is built with Python, FastAPI and is using Redis for data storage.
The recommended installation method is with the [pipx](https://pipx.pypa.io/stable/)
```console
$ pipx install pssecret
$ pipx install pssecret-server
```
For faster performance, install application with [hiredis](https://github.com/redis/hiredis) support.
```console
$ pipx install pssecret[hiredis]
$ pipx install pssecret-server[hiredis]
```
### Running Pssecret server
Make sure you have the Redis service running.
After installation is done, you can start pssecret with `pssecret` command.
After installation is done, you can start pssecret server with `pssecret-server` command.
The web server will be started with `uvicorn` ASGI web server.
```console
$ pssecret
$ pssecret-server
```
### Configuration

View file

@ -4,9 +4,9 @@ from fastapi import Depends, FastAPI
from fastapi.exceptions import HTTPException
from redis.asyncio import Redis
from pssecret.models import Secret, SecretSaveResult
from pssecret.redis_db import get_redis
from pssecret.utils import save_secret
from pssecret_server.models import Secret, SecretSaveResult
from pssecret_server.redis_db import get_redis
from pssecret_server.utils import save_secret
app = FastAPI()

View file

@ -4,7 +4,7 @@ from typing import Annotated
from fastapi import Depends
from redis import asyncio as aioredis
from pssecret.settings import Settings, get_settings
from pssecret_server.settings import Settings, get_settings
def get_redis(settings: Annotated[Settings, Depends(get_settings)]) -> aioredis.Redis:

View file

@ -2,7 +2,7 @@ from uuid import uuid4
from redis.asyncio import Redis
from pssecret.models import Secret
from pssecret_server.models import Secret
async def get_new_key(redis: Redis) -> str:

View file

@ -1,13 +1,13 @@
[tool.poetry]
name = "pssecret"
name = "pssecret-server"
version = "0.0.1"
description = "API service for secrets sharing over network"
authors = ["Ivan Golikov <root@ivnglkv.me>"]
license = "MIT"
readme = "README.md"
homepage = "https://git.ivnglkv.me/root/pssecret"
repository = "https://git.ivnglkv.me/root/pssecret"
documentation = "https://git.ivnglkv.me/root/pssecret/wiki"
homepage = "https://git.ivnglkv.me/root/pssecret-server"
repository = "https://git.ivnglkv.me/root/pssecret-server"
documentation = "https://git.ivnglkv.me/root/pssecret-server/wiki"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Environment :: Web Environment",
@ -19,7 +19,7 @@ classifiers = [
]
[tool.poetry.scripts]
pssecret = 'pssecret.cli:cli'
pssecret-server = 'pssecret_server.cli:cli'
[tool.poetry.dependencies]
python = "^3.11"

View file

@ -5,8 +5,8 @@ from fastapi.testclient import TestClient
from pydantic_settings import SettingsConfigDict
from redis import asyncio as aioredis
from pssecret.main import app
from pssecret.settings import Settings, get_settings
from pssecret_server.main import app
from pssecret_server.settings import Settings, get_settings
class TestSettings(Settings):

View file

@ -1,6 +1,6 @@
from polyfactory.factories.pydantic_factory import ModelFactory
from pssecret.models import Secret
from pssecret_server.models import Secret
class SecretFactory(ModelFactory[Secret]): ...

View file

@ -2,7 +2,7 @@ from unittest.mock import patch
from redis.asyncio import Redis
from pssecret.utils import get_new_key, save_secret
from pssecret_server.utils import get_new_key, save_secret
from ..factories import SecretFactory
@ -17,7 +17,7 @@ async def test_get_new_key_returns_free_key(redis_server: Redis) -> None:
assert res
@patch("pssecret.utils.uuid4", side_effect=("used", "free"))
@patch("pssecret_server.utils.uuid4", side_effect=("used", "free"))
async def test_get_new_key_skips_used_keys(_, redis_server: Redis) -> None:
await redis_server.set("used", "")