just some boilerplate for the project
This commit is contained in:
parent
0f322fd358
commit
3e62ce8b08
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
__pycache__/
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"nixEnvSelector.nixFile": "${workspaceFolder}/shell.nix"
|
||||||
|
}
|
11
bridge/__init__.py
Normal file
11
bridge/__init__.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from flask import Flask
|
||||||
|
from flask import request
|
||||||
|
from flask import redirect
|
||||||
|
from flask import abort
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
app.config.from_envvar('GIT_BRIDGE_SETTINGS')
|
||||||
|
|
||||||
|
@app.route("/bridge")
|
||||||
|
def index():
|
||||||
|
return "you've reached the main page for an internal service. congrats!"
|
1
contrib/sample.cfg
Normal file
1
contrib/sample.cfg
Normal file
@ -0,0 +1 @@
|
|||||||
|
SECRET_KEY="replace_me"
|
19
contrib/service.nix
Normal file
19
contrib/service.nix
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{ lib, pkgs, config, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.services.gmail_mail_bridge;
|
||||||
|
appEnv = pkgs.python3.withPackages (p: with p; [ waitress (callPackage ./bridge/default.nix {}) ]);
|
||||||
|
in {
|
||||||
|
options.services.gmail_mail_bridge = {
|
||||||
|
enable = lib.mkEnableOption "Enable the Gitea-Github bridge";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.gmail_mail_bridge = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${appEnv}/bin/waitress-serve --port=8041 bridge:app";
|
||||||
|
StandardOutput = "journal";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
20
default.nix
Normal file
20
default.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{ pkgs, pythonPackages ? (import <nixpkgs> {}).python3Packages }:
|
||||||
|
pythonPackages.buildPythonPackage {
|
||||||
|
name = "gitea-github-bridge";
|
||||||
|
src = ./bridge;
|
||||||
|
|
||||||
|
propagatedBuildInputs = [ pythonPackages.flask pythonPackages.requests ];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out/${pythonPackages.python.sitePackages}
|
||||||
|
cp -r . $out/${pythonPackages.python.sitePackages}/bridge
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
shellHook = "export FLASK_APP=bridge";
|
||||||
|
|
||||||
|
format = "other";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user