http-redirect: Simplify installing service files

The output file name for the service files was unintentionally
different than the input file name. By installing the service
files in a loop, it gets rid of duplicate code and allows the
use of a variable for the input and output field, fixing the typo.

If a variable was not used, output could be set to @PLAINNAME@
to use the same name as input.

Change-Id: Ic0cef9a21227bbd712a0214c6e78814ba27860ab
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/http-redirect/meson.build b/http-redirect/meson.build
index e73b4ae..840261b 100644
--- a/http-redirect/meson.build
+++ b/http-redirect/meson.build
@@ -8,18 +8,18 @@
         install_dir: get_option('bindir'),
     )
 
-    configure_file(
-        input: 'http-redirect.socket',
-        output: 'http-redirct.socket',
-        copy: true,
-        install_dir:
-            redirect.get_pkgconfig_variable('systemdsystemunitdir'),
-    )
-    configure_file(
-        input: 'http-redirect@.service',
-        output: 'http-redirct@.service',
-        copy: true,
-        install_dir:
-            redirect.get_pkgconfig_variable('systemdsystemunitdir'),
-    )
+    unit_files = [
+        'http-redirect.socket',
+        'http-redirect@.service'
+    ]
+
+    foreach unit : unit_files
+        configure_file(
+            input: unit,
+            output: unit,
+            copy: true,
+            install_dir:
+                redirect.get_pkgconfig_variable('systemdsystemunitdir'),
+        )
+    endforeach
 endif