Compare commits

...

6 Commits

7 changed files with 47 additions and 9 deletions

View File

@ -10,21 +10,24 @@ This project was inspired by Snappass and was previously licensed under MIT.
** Tests :verb:
*** Store secret
POST http://localhost:8000
# To run this tests you need to have Emacs and the package [[https://github.com/federicotdn/verb][verb]] installed.
# Then you can press the following key combination on the headings {C-c C-r C-r}.
template http://localhost:8000
Accept: application/json
Content-Type: application/json
*** Store secret
POST /
{
"ttl": 604800,
"password": "Foo"
}
*** Retrieve secret
POST http://localhost:8000/get-secret
Accept: application/json
Content-Type: application/json
POST /get-secret
{
"key": "snappass941ad23f9e4b4e7fa699854e48f83ff9~tQVYlz56h1bzXVlrCY5W8rYER1sXGtvYtRHrMyXLhSc="
"key": "{{(verb-json-get (oref verb-last body) "key")}}"
}

7
docker-compose.yml Normal file
View File

@ -0,0 +1,7 @@
services:
app:
image: snapbin
ports:
- "8000:8000"
redis:
image: redis

View File

@ -22,7 +22,7 @@
let
pkgs = nixpkgs.legacyPackages.${system};
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; };
env = poetry2nix.mkPoetryEnv {
application = poetry2nix.mkPoetryApplication {
projectDir = ./.;
python = pkgs.python312;
};
@ -33,6 +33,34 @@
'';
in
{
packages = {
snapbin-image = pkgs.dockerTools.buildImage {
name = "snapbin";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ application.dependencyEnv ];
};
config = {
Cmd = [
"${application.dependencyEnv}/bin/gunicorn"
"--bind=0.0.0.0"
"snapbin.main:app"
];
};
};
redis-image = pkgs.dockerTools.buildImage {
name = "redis";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ pkgs.redis ];
};
config = {
Cmd = [ "${pkgs.redis}/bin/redis-server" ];
};
};
};
devShells =
let
config = self.devShells.${system}.default.config;
@ -57,7 +85,7 @@
processes = {
webserver = {
process-compose.depends_on.redis.condition = "process_started";
exec = "gunicorn src.main:app";
exec = "gunicorn snapbin.main:app";
};
};
services.redis.enable = true;

View File

@ -4,7 +4,7 @@ version = "0.1.0"
description = "A little service to store and encrypt information, deleting it once it's retrieved."
authors = ["Andreas Zweili <andreas@zweili.ch>"]
license = "GPL3.0+"
readme = "README.md"
readme = "README.org"
[tool.pylint."MESSAGES CONTROL"]
disable = [