Renamed project to pssecret-server
This commit is contained in:
parent
8266c95cd9
commit
05ba1aa6f1
14 changed files with 23 additions and 24 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,9 +1,8 @@
|
||||||
.*env
|
.*env
|
||||||
.idea/
|
.idea/
|
||||||
.nvim.lua
|
.nvim.lua
|
||||||
|
.pytest_cache/
|
||||||
.python-version
|
.python-version
|
||||||
.venv/
|
.venv/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
build/
|
|
||||||
dist/
|
dist/
|
||||||
pssecret.egg-info/
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ git clone git@git.ivnglkv.me:root/pssecret.git
|
$ git clone git@git.ivnglkv.me:root/pssecret-server.git
|
||||||
$ cd pssecret
|
$ cd pssecret-server
|
||||||
$ poetry install --with=dev
|
$ poetry install --with=dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -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)
|
[![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/)
|
The recommended installation method is with the [pipx](https://pipx.pypa.io/stable/)
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pipx install pssecret
|
$ pipx install pssecret-server
|
||||||
```
|
```
|
||||||
|
|
||||||
For faster performance, install application with [hiredis](https://github.com/redis/hiredis) support.
|
For faster performance, install application with [hiredis](https://github.com/redis/hiredis) support.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pipx install pssecret[hiredis]
|
$ pipx install pssecret-server[hiredis]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running Pssecret server
|
### Running Pssecret server
|
||||||
|
|
||||||
Make sure you have the Redis service running.
|
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.
|
The web server will be started with `uvicorn` ASGI web server.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ pssecret
|
$ pssecret-server
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
|
@ -4,9 +4,9 @@ from fastapi import Depends, FastAPI
|
||||||
from fastapi.exceptions import HTTPException
|
from fastapi.exceptions import HTTPException
|
||||||
from redis.asyncio import Redis
|
from redis.asyncio import Redis
|
||||||
|
|
||||||
from pssecret.models import Secret, SecretSaveResult
|
from pssecret_server.models import Secret, SecretSaveResult
|
||||||
from pssecret.redis_db import get_redis
|
from pssecret_server.redis_db import get_redis
|
||||||
from pssecret.utils import save_secret
|
from pssecret_server.utils import save_secret
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Annotated
|
||||||
from fastapi import Depends
|
from fastapi import Depends
|
||||||
from redis import asyncio as aioredis
|
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:
|
def get_redis(settings: Annotated[Settings, Depends(get_settings)]) -> aioredis.Redis:
|
|
@ -2,7 +2,7 @@ from uuid import uuid4
|
||||||
|
|
||||||
from redis.asyncio import Redis
|
from redis.asyncio import Redis
|
||||||
|
|
||||||
from pssecret.models import Secret
|
from pssecret_server.models import Secret
|
||||||
|
|
||||||
|
|
||||||
async def get_new_key(redis: Redis) -> str:
|
async def get_new_key(redis: Redis) -> str:
|
|
@ -1,13 +1,13 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pssecret"
|
name = "pssecret-server"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
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 = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
homepage = "https://git.ivnglkv.me/root/pssecret"
|
homepage = "https://git.ivnglkv.me/root/pssecret-server"
|
||||||
repository = "https://git.ivnglkv.me/root/pssecret"
|
repository = "https://git.ivnglkv.me/root/pssecret-server"
|
||||||
documentation = "https://git.ivnglkv.me/root/pssecret/wiki"
|
documentation = "https://git.ivnglkv.me/root/pssecret-server/wiki"
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 2 - Pre-Alpha",
|
"Development Status :: 2 - Pre-Alpha",
|
||||||
"Environment :: Web Environment",
|
"Environment :: Web Environment",
|
||||||
|
@ -19,7 +19,7 @@ classifiers = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
pssecret = 'pssecret.cli:cli'
|
pssecret-server = 'pssecret_server.cli:cli'
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.11"
|
python = "^3.11"
|
||||||
|
|
|
@ -5,8 +5,8 @@ from fastapi.testclient import TestClient
|
||||||
from pydantic_settings import SettingsConfigDict
|
from pydantic_settings import SettingsConfigDict
|
||||||
from redis import asyncio as aioredis
|
from redis import asyncio as aioredis
|
||||||
|
|
||||||
from pssecret.main import app
|
from pssecret_server.main import app
|
||||||
from pssecret.settings import Settings, get_settings
|
from pssecret_server.settings import Settings, get_settings
|
||||||
|
|
||||||
|
|
||||||
class TestSettings(Settings):
|
class TestSettings(Settings):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from polyfactory.factories.pydantic_factory import ModelFactory
|
from polyfactory.factories.pydantic_factory import ModelFactory
|
||||||
|
|
||||||
from pssecret.models import Secret
|
from pssecret_server.models import Secret
|
||||||
|
|
||||||
|
|
||||||
class SecretFactory(ModelFactory[Secret]): ...
|
class SecretFactory(ModelFactory[Secret]): ...
|
||||||
|
|
|
@ -2,7 +2,7 @@ from unittest.mock import patch
|
||||||
|
|
||||||
from redis.asyncio import Redis
|
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
|
from ..factories import SecretFactory
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ async def test_get_new_key_returns_free_key(redis_server: Redis) -> None:
|
||||||
assert res
|
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:
|
async def test_get_new_key_skips_used_keys(_, redis_server: Redis) -> None:
|
||||||
await redis_server.set("used", "")
|
await redis_server.set("used", "")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue