Commit 9f023686 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

feat: during irma_configuration parsing, remove folders not present in assets

parent b16ebf49
......@@ -118,8 +118,10 @@ func (conf *Configuration) ParseFolder() (err error) {
conf.clear()
// Copy any new or updated schemes out of the assets into storage
assetsFolders := make(map[string]struct{})
if conf.assets != "" {
err = common.IterateSubfolders(conf.assets, func(dir string, _ os.FileInfo) error {
assetsFolders[filepath.Base(dir)] = struct{}{}
uptodate, err := conf.isUpToDate(filepath.Base(dir))
if err != nil {
return err
......@@ -132,6 +134,16 @@ func (conf *Configuration) ParseFolder() (err error) {
if err != nil {
return err
}
if err = common.IterateSubfolders(conf.Path, func(dir string, _ os.FileInfo) error {
basedir := filepath.Base(dir)
if _, presentInAssets := assetsFolders[basedir]; !presentInAssets {
Logger.Warnf(`Found dir "%s" in irma_configuration that is not in assets; removing`, basedir)
return os.RemoveAll(dir)
}
return nil
}); err != nil {
return err
}
}
// Since requestor schemes may contain information defined in issuer schemes, first check
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment