Ejemplo n.º 1
0
    def run(self, args):
        from os import environ, path
        from deployer.src.config_creator import create_config

        if len(args) > 0 and "http" in args[0]:
            config = create_config(args[0])
        else:
            config = create_config()

        config_folder = environ.get("PUBLIC_CONFIG_FOLDER")

        if config_folder is None:
            print("PUBLIC_CONFIG_FOLDER must be defined in environment")

        if config_folder is None:
            self.print_config(config)
        else:
            config_folder += "/configs"
            if not path.isdir(config_folder):
                self.print_config(config)
                print("Folder: " + config_folder + " does not exist")
                return

            file_path = config_folder + "/" + config["index_name"] + ".json"

            if path.isfile(file_path):
                self.print_config(config)
                print("File: " + file_path + " already exists")
                return

            file = open(file_path, "w")
            file.write(self.config_to_s(config))
            file.close()

            print(file_path + " has been created")
Ejemplo n.º 2
0
 def run(self, args):
     return create_config()
Ejemplo n.º 3
0
 def run(self, args):
     return create_config()
Ejemplo n.º 4
0
 def run(self, args):
     from deployer.src.config_creator import create_config
     return create_config()
Ejemplo n.º 5
0
 def run(self, args):
     from deployer.src.config_creator import create_config
     if len(args) > 0 and "http" in args[0]:
         return create_config(args[0])
     return create_config()