コード例 #1
0
    def env2compile(cls, env):
        logger = HenriqueLogger.func_level2logger(cls.env2compile,
                                                  logging.DEBUG)
        logger.debug({"env": env})

        uwsgi_mode = HenriqueUwsgi.env2mode(env)

        nginx_mode = HenriqueNginx.env2mode(env)
        uid = HenriqueNginx.Mode.mode2user(nginx_mode)
        gid = HenriqueNginx.Mode.mode2group(nginx_mode)

        data = {
            "env": env,
            "uid": uid,
            "gid": gid,
            "uwsgi_mode": uwsgi_mode,
        }

        filepath = os.path.join(FILE_DIR, "conf",
                                "henrique.supervisord.{}.conf".format(env))
        utf8 = Jinja2Renderer.template2text(cls.template(), data=data)
        FileTool.utf82file(utf8, filepath)

        logger.debug({
            "filepath": filepath,
            "data": data,
        })
コード例 #2
0
 def env2compile(cls, env):
     h = cls.env2dict(env)
     lines = ["{}={}".format(k, v) for k, v in h.items()]
     filepath = os.path.join(REPO_DIR, "henrique", "env", "docker",
                             "env.{}.list".format(env))
     FileTool.makedirs_or_skip(os.path.dirname(filepath))
     FileTool.utf82file("\n".join(lines), filepath)
コード例 #3
0
    def mode2compile(cls, mode):
        data = {
            "mode": mode,
        }

        filepath = os.path.join(FILE_DIR, "ini",
                                "henrique.uwsgi.{}.ini".format(mode))
        utf8 = Jinja2Renderer.template2text(cls.template(), data=data)
        FileTool.utf82file(utf8, filepath)
コード例 #4
0
def main():
    logging.basicConfig(level=logging.INFO)
    envname = os.environ.get("ENV")

    filepath_yaml = os.path.join(REPO_DIR, "config.yaml")
    filepath_dotenv = os.path.join(REPO_DIR, ".envrc")

    s_env = yaml_envname2kv_list(filepath_yaml, envname)

    FileTool.utf82file(s_env, filepath_dotenv)
コード例 #5
0
ファイル: cache_tool.py プロジェクト: lbox-kr/foxylib
    def f_or_file2utf8(cls, f, filepath):
        logger = FoxylibLogger.func2logger(cls.f_or_file2utf8)
        # logger.debug({"filepath": filepath, "f": f})

        FileTool.dirpath2mkdirs(os.path.dirname(filepath))

        utf8 = FileTool.filepath2utf8(filepath)

        if utf8:
            return utf8

        utf8 = f()
        if utf8 is not None:
            FileTool.utf82file(utf8, filepath)
        return utf8
コード例 #6
0
    def env2compile(cls, env):
        domain_name = cls.env2domain_name(env)

        mode = cls.env2mode(env)
        nginx_dir = cls.Mode.mode2nginx_dir(mode)
        socket = cls.Mode.mode2socket(mode)
        uid = cls.Mode.mode2user(mode)
        gid = cls.Mode.mode2group(mode)

        data = {"DOMAIN_NAME": domain_name,
                "NGINX_DIR": nginx_dir,
                "socket": socket,
                "uid": uid,
                "gid": gid,
                "FILEPATH_SSL_CERTI": None,
                "FILEPATH_SSL_PRIVATE_KEY": None,
                }

        filepath = os.path.join(FILE_DIR, "conf","henrique.nginx.{}.conf".format(env))
        utf8 = Jinja2Renderer.template2text(cls.template(), data=data)
        FileTool.utf82file(utf8, filepath)