From e5f72caf44857f60744d91044aeb18740bc16078 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Thu, 3 Jan 2019 15:45:22 +0100
Subject: [PATCH] simplify configuration format

---
 bin/update-metadata.in | 11 +++++------
 conf/manager.conf.in   | 21 ++++-----------------
 2 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/bin/update-metadata.in b/bin/update-metadata.in
index 1ea68c8..992580f 100755
--- a/bin/update-metadata.in
+++ b/bin/update-metadata.in
@@ -53,14 +53,13 @@ AccountManager::Entity->delete_entities(all => 1);
 $db->dbh()->do('ALTER TABLE entities AUTO_INCREMENT = 1');
 
 my %seen;
-foreach my $id (split(/, */, $configuration->{groups}->{list})) {
-    my $spec = $configuration->{$id};
-    next unless $spec->{type} eq 'metadata';
+foreach my $id (keys %{$configuration->{federations}}) {
     print "processing federation $id\n" if $options{verbose};
-    my $file = File::Temp->new();
 
-    print "downloading metadata from url $spec->{url}\n" if $options{verbose};
-    my $response = $ua->get($spec->{url}, ':content_file' => $file->filename());
+    my $file = File::Temp->new();
+    my $url = $configuration->{federations}->{$id};
+    print "downloading metadata from url $url\n" if $options{verbose};
+    my $response = $ua->get($url, ':content_file' => $file->filename());
     if (!$response->is_success()) {
         $db->rollback();
         die "failed to download federation metadata: " . $response->status_line();
diff --git a/conf/manager.conf.in b/conf/manager.conf.in
index 44b453b..ac852a0 100644
--- a/conf/manager.conf.in
+++ b/conf/manager.conf.in
@@ -11,23 +11,10 @@ templates_dir = @templatesdir@
 templates_theme = edugain
 accounts_file = /var/lib/access-check/accounts.php
 
-[groups]
-list = self, renater, edugain
-
-[self]
-type = organization
-label = my own organization
-
-[renater]
-type = metadata
-file = /var/lib/access-check/renater.xml
-label = fédération Education-Recherche
-
-[edugain]
-type = link
-url = https://access-check.edugain.org
-label = eduGAIN
-message = eduGAIN Access Check
+[federations]
+# list of all federations from which to fetch metadata
+edugain = https://mds.edugain.org/
+aconet = https://eduid.at/md/aconet-registered.xml
 
 [logger]
 file = /var/log/access-check/manager.log
-- 
GitLab