about summary refs log tree commit diff
path: root/src/nm-cloud-setup/nmcs-provider-ec2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm-cloud-setup/nmcs-provider-ec2.c')
-rw-r--r--src/nm-cloud-setup/nmcs-provider-ec2.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/nm-cloud-setup/nmcs-provider-ec2.c b/src/nm-cloud-setup/nmcs-provider-ec2.c
index 14b0b740..6f83238d 100644
--- a/src/nm-cloud-setup/nmcs-provider-ec2.c
+++ b/src/nm-cloud-setup/nmcs-provider-ec2.c
@@ -29,21 +29,7 @@ again:
          * This is mainly for testing, it's not usually supposed to be configured.
          * Consider this private API! */
         base = g_getenv(NMCS_ENV_VARIABLE("NM_CLOUD_SETUP_EC2_HOST"));
-
-        if (base && base[0] && !strchr(base, '/')) {
-            if (NM_STR_HAS_PREFIX(base, "http://") || NM_STR_HAS_PREFIX(base, "https://"))
-                base = g_intern_string(base);
-            else {
-                gs_free char *s = NULL;
-
-                s    = g_strconcat("http://", base, NULL);
-                base = g_intern_string(s);
-            }
-        }
-        if (!base)
-            base = NM_EC2_BASE;
-
-        nm_assert(!NM_STR_HAS_SUFFIX(base, "/"));
+        base = nmcs_utils_uri_complete_interned(base) ?: ("" NM_EC2_BASE);
 
         if (!g_atomic_pointer_compare_and_exchange(&base_cached, NULL, base))
             goto again;