aboutsummaryrefslogtreecommitdiffstats
path: root/klaus/app.py
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2022-09-19 19:08:29 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2022-09-19 19:08:29 +0100
commit135f7ec31ccc691b626d465a70fcac97baa895f7 (patch)
treeb6783700415dda7c8f551e75b9e4a169365a4db0 /klaus/app.py
parentcfa6e98a33e89291b19376e9e1ab25510afdfb7d (diff)
downloadgit-scripts-135f7ec31ccc691b626d465a70fcac97baa895f7.tar.gz
git-scripts-135f7ec31ccc691b626d465a70fcac97baa895f7.zip
Added automatically restarting the web ui when a new repo is created
Diffstat (limited to 'klaus/app.py')
-rwxr-xr-xklaus/app.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/klaus/app.py b/klaus/app.py
index 3ddd08b..6b2205e 100755
--- a/klaus/app.py
+++ b/klaus/app.py
@@ -3,10 +3,22 @@ import waitress
import klaus
import os
-repositories = ["/srv/git/git-scripts.git", "/srv/git/anExampleRepo%21.git"]
+def get_repo_paths(metadata_path):
+ repo_paths = []
+ for filename in os.listdir(metadata_path):
+ if filename.endswith(".git.conf"):
+ meta = configparser.ConfigParser()
+ meta.read(os.path.join(metadata_path, filename))
+ repo_name = filename[:-5]
+ if meta.getboolean(repo_name, "visible"):
+ repo_paths.append(meta.get(repo_name, "path"))
+
+ return repo_paths
if __name__ == "__main__":
+ repositories = get_repo_paths("/srv/repos")
+ print("Using repository paths: %s" % " ".join(repositories))
app = klaus.make_app(repositories, "Eden's git server - Repositories")
waitress.serve(app, host = "0.0.0.0", port = 80, threads = int(os.environ["APP_THREADS"]))