Пример #1
0
def read_default_options(account_section='Account'):
    client_config = ConfigFile(CONFIG_FILE)
    Account.read(cfgfile=client_config, section=account_section)
    if client_config.get_section(account_section) is None:
        return None
    else:
        return dict(Account)
Пример #2
0
def read_default_options(account_section='Account'):
    client_config = ConfigFile(CONFIG_FILE)
    Account.read(cfgfile=client_config, section=account_section)
    if client_config.get_section(account_section) is None:
        return None
    else:
        return dict(Account)
Пример #3
0
def get_auth_config(domain):
    config_file = ConfigFile(AuthConfig.__cfgfile__)
    section = config_file.get_section(domain)
    if section is not None:
        AuthConfig.read(section=domain)
        config = AuthConfiguration(dict(AuthConfig))
        AuthConfig.reset()
    else:
        config = AuthConfiguration(dict(AuthConfig))  # use auth defaults
    return config
Пример #4
0
def get_room_config(room):
    config_file = ConfigFile(RoomConfig.__cfgfile__)
    section = config_file.get_section(room)
    if section is not None:
        RoomConfig.read(section=room)
        config = Configuration(dict(RoomConfig))
        RoomConfig.reset()
    else:
        # Apply general policy
        config = Configuration(dict(RoomConfig))
    return config
Пример #5
0
def get_room_config(room):
    config_file = ConfigFile(RoomConfig.__cfgfile__)
    section = config_file.get_section(room)
    if section is not None:
        RoomConfig.read(section=room)
        config = VideoroomConfiguration(dict(RoomConfig))
        RoomConfig.reset()
    else:
        config = VideoroomConfiguration(dict(RoomConfig))  # use room defaults
    config.recording_dir = os.path.join(GeneralConfig.recording_dir, room)
    return config
Пример #6
0
def get_config(uri):
    config_file = ConfigFile(PlaybackConfig.__cfgfile__)
    GeneralConfig.read(cfgfile=config_file)
    section = config_file.get_section(uri)
    if section is not None:
        PlaybackConfig.read(section=uri)
        if not os.path.isabs(PlaybackConfig.file):
            PlaybackConfig.file = os.path.join(GeneralConfig.files_dir, PlaybackConfig.file)
        config = Configuration(dict(PlaybackConfig))
        PlaybackConfig.reset()
        return config
    return None
Пример #7
0
def get_config(uri):
    config_file = ConfigFile(PlaybackConfig.__cfgfile__)
    GeneralConfig.read(cfgfile=config_file)
    section = config_file.get_section(uri)
    if section is not None:
        PlaybackConfig.read(section=uri)
        if not os.path.isabs(PlaybackConfig.file):
            PlaybackConfig.file = os.path.join(GeneralConfig.files_dir,
                                               PlaybackConfig.file)
        config = Configuration(dict(PlaybackConfig))
        PlaybackConfig.reset()
        return config
    return None
Пример #8
0
    __section__ = 'Storage'
    dburi = 'mysql://undefined@localhost/database'


# Dump the values of the options after they were loaded from the config file
print("Settings in the automatically loaded sections\n")
print()
print(AutoNetworkConfig)
print()
print(AutoStorageConfig)
print()

# We can also get individual settings from a given section.
#
# For this we create ConfigFile instance that will handle the configuration
# file. The information about the system and local configuration directories
# and where are the configuration files being looked up (which was presented
# above with the ConfigSection.read() method) apply here as well.
#

print("\n------------------------------------\n")
print("Reading individual settings from sections without using ConfigSection")

configuration = ConfigFile('config.ini')

dburi = configuration.get_setting('Storage',
                                  'dburi',
                                  type=str,
                                  default='undefined')
print("\nGot dburi directly from Storage section as `%s'\n" % dburi)