from pathlib import Path from jinja2_simple_tags import StandaloneTag class StaticTag(StandaloneTag): tags = {"static"} def render(self, filename="/", hubapp=None): if not hubapp: hubapp = self.context["hubapp"] elif isinstance(hubapp, str): hubapp = self.context["hubapp"].app.hubapps[hubapp] return hubapp.uri_from(Path(filename)) def get_redis_pass(redis_conf): prefix = "requirepass " with open(redis_conf, "rt") as fh: for line in fh: if not line.startswith(prefix): continue return line[len(prefix) :].rstrip() return None