Rename project to pssecret #2

Merged
root merged 1 commit from rename-to-psssecret into main 2024-12-25 11:43:24 +00:00
14 changed files with 30 additions and 33 deletions

3
.flake8 Normal file
View file

@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203, B008

4
.gitignore vendored
View file

@ -1,7 +1,7 @@
venv/ venv/
.idea/ .idea/
dist/ dist/
rectes.egg-info/ pssecret.egg-info/
build/ build/
conf/rectes.toml conf/pssecret.toml
__pycache__/ __pycache__/

View file

@ -1,29 +1,28 @@
repos: repos:
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.3.0 rev: 24.10.0
hooks: hooks:
- id: black - id: black
language_version: python3.11 language_version: python3.11
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0 rev: v5.0.0
hooks: hooks:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/pycqa/flake8 - repo: https://github.com/pycqa/flake8
rev: 4.0.1 rev: 7.1.1
hooks: hooks:
- id: flake8 - id: flake8
entry: pflake8 args: [--config, .flake8]
additional_dependencies: additional_dependencies:
- flake8-bugbear - flake8-bugbear
- flake8-comprehensions - flake8-comprehensions
- flake8-simplify - flake8-simplify
- pyproject-flake8
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 5.10.1 rev: 5.13.2
hooks: hooks:
- id: isort - id: isort
name: isort name: isort

View file

@ -1,8 +1,8 @@
# Rectes # Pssecret
[![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)
Rectes (anagram from "secret") is self-hosted service to share secrets (like passwords) with somebody Pssecret is self-hosted service to share secrets (like passwords) with somebody
over the network, but don't want them to appear in chats, unencrypted e-mails, etc. over the network, but don't want them to appear in chats, unencrypted e-mails, etc.
This service tries to be as anonymous as possible. The only personal information that will be stored This service tries to be as anonymous as possible. The only personal information that will be stored
@ -23,7 +23,7 @@ Service is built with Python, FastAPI and is using Redis for data storage.
#### TL/DR #### TL/DR
```bash ```bash
$ git clone git@git.ivnglkv.ru:ivnglkv/rectes.git $ git clone git@git.ivnglkv.me:root/pssecret.git
$ python3 -m venv venv $ python3 -m venv venv
$ . ./venv/bin/activate $ . ./venv/bin/activate
$ pip install . $ pip install .
@ -31,33 +31,33 @@ $ pip install .
--- ---
Steps to install Rectes: Steps to install Pssecret:
1. Clone repository 1. Clone repository
2. (optional) Create virtual environment 2. (optional) Create virtual environment
3. Install package 3. Install package
### Running Rectes server ### Running Pssecret server
After installation is done, you can start rectes with `rectes` command. After installation is done, you can start pssecret with `pssecret` command.
The web server will be started with `uvicorn` ASGI web server. The web server will be started with `uvicorn` ASGI web server.
```bash ```bash
$ rectes $ pssecret
``` ```
### Configuration ### Configuration
Configuration is done through config file. By default, path is `/etc/rectes/rectes.toml`. Configuration is done through config file. By default, path is `/etc/pssecret/pssecret.toml`.
You can override this by setting environment variable `RECTES_CONF_FILE` value to actual file You can override this by setting environment variable `PSSECRET_CONF_FILE` value to actual file
location, i.e.: location, i.e.:
```bash ```bash
$ RECTES_CONF_FILE=/home/user/.conf/rectes.toml rectes $ PSSECRET_CONF_FILE=/home/user/.conf/pssecret.toml pssecret
``` ```
You can find all available configuration options in the example file, located You can find all available configuration options in the example file, located
at [conf/rectes.toml.example](conf/rectes.toml.example) under Git root. at [conf/pssecret.toml.example](conf/pssecret.toml.example) under Git root.
## Contributing ## Contributing
@ -66,7 +66,7 @@ Flake8 and isort. Prior to making any commits, install `pre-commit` tool and ins
```bash ```bash
# Alternatively, you could use 'pip install ".[development]"' # Alternatively, you could use 'pip install ".[development]"'
$ pip install pre-commit==2.19.0 $ pip install pre-commit
$ pre-commit install $ pre-commit install
``` ```

View file

@ -4,7 +4,3 @@ build-backend = "setuptools.build_meta"
[tool.isort] [tool.isort]
profile = "black" profile = "black"
[tool.flake8]
max-line-length = 88
extend-ignore = "E203, B008"

View file

@ -1,5 +1,5 @@
[metadata] [metadata]
name = rectes name = pssecret
version = 0.1 version = 0.1
[options] [options]
@ -18,7 +18,7 @@ development =
[options.entry_points] [options.entry_points]
console_scripts = console_scripts =
rectes = rectes:cli pssecret = pssecret:cli
[options.packages.find] [options.packages.find]
where = src where = src

View file

@ -1,9 +1,9 @@
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.exceptions import HTTPException from fastapi.exceptions import HTTPException
from rectes.models import Secret, SecretSaveResult from pssecret.models import Secret, SecretSaveResult
from rectes.redis_db import redis from pssecret.redis_db import redis
from rectes.utils import get_new_key from pssecret.utils import get_new_key
app = FastAPI() app = FastAPI()

View file

@ -1,6 +1,6 @@
# noinspection PyUnresolvedReferences,PyProtectedMember # noinspection PyUnresolvedReferences,PyProtectedMember
from redis import asyncio as aioredis from redis import asyncio as aioredis
from rectes.settings import settings from pssecret.settings import settings
redis = aioredis.from_url(settings.redis.url) redis = aioredis.from_url(settings.redis.url)

View file

@ -1,5 +1,4 @@
import os import os
import tomllib import tomllib
@ -9,7 +8,7 @@ class Settings:
self._data = data self._data = data
else: else:
with open( with open(
os.getenv("RECTES_CONF_FILE", "/etc/rectes/rectes.toml"), "rb" os.getenv("PSSECRET_CONF_FILE", "/etc/pssecret/pssecret.toml"), "rb"
) as f: ) as f:
self._data = tomllib.load(f) self._data = tomllib.load(f)

View file

@ -1,6 +1,6 @@
from uuid import uuid4 from uuid import uuid4
from rectes.redis_db import redis from pssecret.redis_db import redis
async def get_new_key() -> str: async def get_new_key() -> str: