add redirects to config
This commit is contained in:
parent
d396e3abae
commit
b4ec6d16b3
2 changed files with 14 additions and 8 deletions
|
@ -91,7 +91,7 @@
|
||||||
(str/join
|
(str/join
|
||||||
(str "\n" (str/join (take indent (repeat " "))))
|
(str "\n" (str/join (take indent (repeat " "))))
|
||||||
(map
|
(map
|
||||||
#(str "rewrite ^" (first %1) "$ " (second %1) " permanent;")
|
#(str "rewrite ^" (first %1) "\\$ " (second %1) " permanent;")
|
||||||
redirects))))
|
redirects))))
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,12 +101,17 @@
|
||||||
name (replace-dots-by-minus unique-name)]
|
name (replace-dots-by-minus unique-name)]
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "website/nginx-configmap.yaml")
|
(yaml/load-as-edn "website/nginx-configmap.yaml")
|
||||||
(assoc-in [:metadata :namespace] name)
|
|
||||||
(replace-all-matching-substrings-beginning-with "NAME" name)
|
(replace-all-matching-substrings-beginning-with "NAME" name)
|
||||||
(#(assoc-in %
|
(#(assoc-in % [:data :website.conf]
|
||||||
[:data :website.conf]
|
|
||||||
(str/replace
|
(str/replace
|
||||||
(-> % :data :website.conf) #"FQDN" (str (str/join " " fqdns) ";")))))))
|
(-> % :data :website.conf)
|
||||||
|
#"FQDN"
|
||||||
|
(str (str/join " " fqdns) ";"))))
|
||||||
|
(#(assoc-in % [:data :website.conf]
|
||||||
|
(str/replace
|
||||||
|
(-> % :data :website.conf)
|
||||||
|
#"REDIRECTS"
|
||||||
|
(generate-redirects config 2)))))))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-website-build-secret pred/map-or-seq?
|
(defn-spec generate-website-build-secret pred/map-or-seq?
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
(st/instrument `cut/generate-nginx-service)
|
(st/instrument `cut/generate-nginx-service)
|
||||||
|
|
||||||
(deftest should-generate-redirects
|
(deftest should-generate-redirects
|
||||||
(is (= "rewrite ^/products.html$ /offer.html permanent;\n rewrite ^/one-more$ /redirect permanent;"
|
(is (= "rewrite ^/products.html\\$ /offer.html permanent;\n rewrite ^/one-more\\$ /redirect permanent;"
|
||||||
(cut/generate-redirects {:issuer "staging"
|
(cut/generate-redirects {:issuer "staging"
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
:build-cpu-limit "1700m"
|
:build-cpu-limit "1700m"
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
:metadata :namespace))))
|
:metadata :namespace))))
|
||||||
|
|
||||||
(deftest should-generate-nginx-configmap-website
|
(deftest should-generate-nginx-configmap-website
|
||||||
(is (= "server {\n listen 80 default_server;\n listen [::]:80 default_server;\n server_name test.de www.test.de test-it.de www.test-it.de;\n add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload'; \n add_header X-Frame-Options \"SAMEORIGIN\";\n add_header X-Content-Type-Options nosniff;\n add_header Referrer-Policy \"strict-origin\";\n # add_header Permissions-Policy \"permissions here\";\n root /var/www/html/website/;\n index index.html;\n location / {\n try_files $uri $uri/ /index.html =404;\n }\n # redirects\n REDIRECTS\n}\n"
|
(is (= "server {\n listen 80 default_server;\n listen [::]:80 default_server;\n server_name test.de www.test.de test-it.de www.test-it.de;\n add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload'; \n add_header X-Frame-Options \"SAMEORIGIN\";\n add_header X-Content-Type-Options nosniff;\n add_header Referrer-Policy \"strict-origin\";\n # add_header Permissions-Policy \"permissions here\";\n root /var/www/html/website/;\n index index.html;\n location / {\n try_files $uri $uri/ /index.html =404;\n }\n # redirects\n rewrite ^/products.html$ /offer.html permanent;\n rewrite ^/one-more$ /redirect permanent;\n}\n"
|
||||||
(:website.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
(:website.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
:build-cpu-limit "1700m"
|
:build-cpu-limit "1700m"
|
||||||
|
@ -88,7 +88,8 @@
|
||||||
:build-memory-limit "512Mi"
|
:build-memory-limit "512Mi"
|
||||||
:volume-size "3"
|
:volume-size "3"
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects [],
|
:redirects [["/products.html", "/offer.html"]
|
||||||
|
["/one-more", "/redirect"]]
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:forgejo-repo "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
|
|
Loading…
Reference in a new issue