extractFromConfig prefix config = foldl addIfMatches [] config
   where
      addIfMatches c (key,val) = if startsWith prefix key then (strip key,val):c else c
      strip key = drop (length prefix) key
      startsWith (x:xs) (y:ys) = if x == y then startsWith xs ys else False
      startsWith [] ys = True
      startsWith xs [] = False

-- TODO: Check environment variable
extractFromConfig prefix config = foldl addIfMatches [] config
   where
      addIfMatches c (key,val) = if startsWith prefix key then (strip key,val):c else c
      strip key = drop (length prefix) key
      startsWith (x:xs) (y:ys) = if x == y then startsWith xs ys else False
      startsWith [] ys = True
      startsWith xs [] = False

-- TODO: Check environment variable
extractFromConfig prefix config = foldl addIfMatches [] config
   where
      addIfMatches c (key,val) = if startsWith prefix key then (strip key,val):c else c
      strip key = drop (length prefix) key
      startsWith (x:xs) (y:ys) = if x == y then startsWith xs ys else False
      startsWith [] ys = True
      startsWith xs [] = False

-- TODO: Check environment variable