class CreateRtcConfigFiles:
    # constructor
    def __init__(self, config_file):
        self.bcr = BaseConfigReader(config_file)
        self.d = {}

    # main run method
    # single threaded periodic timer implementation
    def run(self):
        self.d = self.bcr.get_dict()

        # validate base config
        nginx_section_status = self.bcr.validate_nginx_section()
        if not nginx_section_status:
            sys.exit("Invalid nginx section. exiting...")
        prosody_section_status = self.bcr.validate_prosody_section()
        if not prosody_section_status:
            sys.exit("Invalid prosody section. exiting...")
        jicofo_section_status = self.bcr.validate_jicofo_section()
        if not jicofo_section_status:
            sys.exit("Invalid jicofo section. exiting...")
        jvb_section_status = self.bcr.validate_jvb_section()
        if not jvb_section_status:
            sys.exit("Invalid jvb section. exiting...")
        #jirecon_section_status = self.bcr.validate_jirecon_section()
        #if not jirecon_section_status:
        #sys.exit("Invalid jirecon section. exiting...")

        # generate config files
        nginx_config_status = create_nginx_config(self.d['PROSODY'],
                                                  self.d['NGINX'])
        if not nginx_config_status:
            sys.exit("nginx config file not created. Exiting ...")
        prosody_config_status = create_prosody_config(self.d['PROSODY'],
                                                      self.d['NGINX'])
        if not prosody_config_status:
            sys.exit("prosody config file not created. Exiting ...")
        jicofo_config_status = create_jicofo_config(self.d['PROSODY'],
                                                    self.d['JICOFO'])
        if not jicofo_config_status:
            sys.exit("jicofo config file not created. Exiting ...")
        videobridge_config_status = create_videobridge_config(
            self.d['PROSODY'], self.d['JVB'])
        if not videobridge_config_status:
            sys.exit("videobridge config file not created. Exiting ...")
class CreateRtcConfigFiles:
    # constructor
    def __init__(self, config_file):
        self.bcr = BaseConfigReader(config_file)
        self.d = {}

        # main run method
        # single threaded periodic timer implementation

    def run(self):
        self.d = self.bcr.get_dict()

        # validate base config
        nginx_section_status = self.bcr.validate_nginx_section()
        if not nginx_section_status:
            sys.exit("Invalid nginx section. exiting...")
        prosody_section_status = self.bcr.validate_prosody_section()
        if not prosody_section_status:
            sys.exit("Invalid prosody section. exiting...")
        jicofo_section_status = self.bcr.validate_jicofo_section()
        if not jicofo_section_status:
            sys.exit("Invalid jicofo section. exiting...")
        jvb_section_status = self.bcr.validate_jvb_section()
        if not jvb_section_status:
            sys.exit("Invalid jvb section. exiting...")
            # jirecon_section_status = self.bcr.validate_jirecon_section()
            # if not jirecon_section_status:
            # sys.exit("Invalid jirecon section. exiting...")

            # generate config files
        nginx_config_status = create_nginx_config(self.d["PROSODY"], self.d["NGINX"])
        if not nginx_config_status:
            sys.exit("nginx config file not created. Exiting ...")
        prosody_config_status = create_prosody_config(self.d["PROSODY"], self.d["NGINX"])
        if not prosody_config_status:
            sys.exit("prosody config file not created. Exiting ...")
        jicofo_config_status = create_jicofo_config(self.d["PROSODY"], self.d["JICOFO"])
        if not jicofo_config_status:
            sys.exit("jicofo config file not created. Exiting ...")
        videobridge_config_status = create_videobridge_config(self.d["PROSODY"], self.d["JVB"])
        if not videobridge_config_status:
            sys.exit("videobridge config file not created. Exiting ...")
 def __init__(self, config_file):
     self.bcr = BaseConfigReader(config_file)
     self.d = {}
 def __init__(self, config_file):
     self.bcr = BaseConfigReader(config_file)
     self.d = {}