Project

General

Profile

« Previous | Next » 

Revision ef24d7f9

Added by Marc Dequènes about 15 years ago

  • ID ef24d7f968b3934a5f778891ab431824ff4fc450

[evol] improve config #2 (aspects config is separated)

View differences:

bin/shadowwalker
cmdparser.add_command(CmdParse::VersionCommand.new)
def load_config_components(type)
c_config_dir = File.join(LdapShadows::Config::CFG_DIR, type)
c_config_pattern = File.join(c_config_dir, "**", "*.conf")
Dir.glob(c_config_pattern).each do |f|
next if f[0..0] == "."
c_name = File.basename(f).sub(".conf", "").to_sym
c_config = YAML.load(IO.read(f))
c_config.recursive_symbolize_keys!
yield(c_name, c_config)
end
end
$ldapctl = Controller.new
$ldapctl.set_global_config(config[:presentation])
config[:aspects].each_pair do |aspect_name, aspect_data|
$ldapctl.set_aspect(aspect_name, aspect_data)
load_config_components("aspects") do |c_name, c_config|
$ldapctl.set_aspect(c_name, c_config)
end
begin
ActiveLdap::Base.setup_connection(config[:ldap])
obj_config_dir = File.join(LdapShadows::Config::CFG_DIR, "objects")
obj_config_pattern = File.join(obj_config_dir, "**", "*.conf")
Dir.glob(obj_config_pattern).each do |f|
next if f[0..0] == "."
obj_name = File.basename(f).sub(".conf", "")
obj_config = YAML.load(IO.read(f))
obj_config.recursive_symbolize_keys!
$ldapctl.load_object(obj_name, obj_config)
load_config_components("objects") do |c_name, c_config|
$ldapctl.load_object(c_name, c_config)
end
$ldapctl.load_relations

Also available in: Unified diff