feature/introduce-redirects #4
4 changed files with 61 additions and 61 deletions
|
@ -27,7 +27,7 @@
|
|||
"js-yaml": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"shadow-cljs": "^2.11.18",
|
||||
"shadow-cljs": "^2.27.4",
|
||||
"source-map-support": "^0.5.21"
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||
:dependencies [[org.clojure/clojure "1.11.1"]
|
||||
[org.clojure/tools.reader "1.4.0"]
|
||||
[org.domaindrivenarchitecture/c4k-common-clj "6.1.4-SNAPSHOT"]
|
||||
[org.domaindrivenarchitecture/c4k-common-clj "6.2.1"]
|
||||
[hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]]
|
||||
:target-path "target/%s/"
|
||||
:source-paths ["src/main/cljc"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"src/test/cljc"
|
||||
"src/test/cljs"
|
||||
"src/test/resources"]
|
||||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.1.3"]
|
||||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.2.1"]
|
||||
[hickory "0.7.1"]]
|
||||
:builds {:frontend {:target :browser
|
||||
:modules {:main {:init-fn dda.c4k-website.browser/init}}
|
||||
|
|
|
@ -79,64 +79,64 @@
|
|||
:volume-size 3})
|
||||
:metadata :namespace))))
|
||||
|
||||
(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 rewrite ^/products.html$ /offer.html permanent;\n rewrite ^/one-more$ /redirect permanent;\n}\n"
|
||||
(:website.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [["/products.html", "/offer.html"]
|
||||
["/one-more", "/redirect"]]
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))))
|
||||
(is (= "types {\n text/html html htm shtml;\n text/css css;\n text/xml xml rss;\n image/gif gif;\n image/jpeg jpeg jpg;\n application/x-javascript js;\n text/plain txt;\n text/x-component htc;\n text/mathml mml;\n image/svg+xml svg svgz;\n image/png png;\n image/x-icon ico;\n image/x-jng jng;\n image/vnd.wap.wbmp wbmp;\n application/java-archive jar war ear;\n application/mac-binhex40 hqx;\n application/pdf pdf;\n application/x-cocoa cco;\n application/x-java-archive-diff jardiff;\n application/x-java-jnlp-file jnlp;\n application/x-makeself run;\n application/x-perl pl pm;\n application/x-pilot prc pdb;\n application/x-rar-compressed rar;\n application/x-redhat-package-manager rpm;\n application/x-sea sea;\n application/x-shockwave-flash swf;\n application/x-stuffit sit;\n application/x-tcl tcl tk;\n application/x-x509-ca-cert der pem crt;\n application/x-xpinstall xpi;\n application/zip zip;\n application/octet-stream deb;\n application/octet-stream bin exe dll;\n application/octet-stream dmg;\n application/octet-stream eot;\n application/octet-stream iso img;\n application/octet-stream msi msp msm;\n audio/mpeg mp3;\n audio/x-realaudio ra;\n video/mpeg mpeg mpg;\n video/quicktime mov;\n video/x-flv flv;\n video/x-msvideo avi;\n video/x-ms-wmv wmv;\n video/x-ms-asf asx asf;\n video/x-mng mng;\n}\n"
|
||||
(:mime.types (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [],
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))))
|
||||
(is (= "user nginx;\nworker_processes 3;\nerror_log stdout info;\npid /var/log/nginx/nginx.pid;\nworker_rlimit_nofile 8192;\nevents {\n worker_connections 4096;\n}\nhttp {\n include /etc/nginx/mime.types;\n default_type application/octet-stream;\n log_format main '$remote_addr - $remote_user [$time_local] $status'\n '\"$request\" $body_bytes_sent \"$http_referer\"'\n '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n access_log stdout main;\n sendfile on;\n tcp_nopush on;\n keepalive_timeout 65;\n server_names_hash_bucket_size 128;\n include /etc/nginx/conf.d/website.conf;\n}\n"
|
||||
(:nginx.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [],
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))))
|
||||
(is (= {:apiVersion "v1",
|
||||
:kind "ConfigMap",
|
||||
:metadata {:labels {:app.kubernetes.part-of "test-io-website"},
|
||||
:namespace "test-io",
|
||||
:name "etc-nginx"}}
|
||||
(dissoc (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [],
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}) :data))))
|
||||
#?(:clj (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 rewrite ^/products.html$ /offer.html permanent;\n rewrite ^/one-more$ /redirect permanent;\n}\n"
|
||||
(:website.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [["/products.html", "/offer.html"]
|
||||
["/one-more", "/redirect"]]
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))))
|
||||
(is (= "types {\n text/html html htm shtml;\n text/css css;\n text/xml xml rss;\n image/gif gif;\n image/jpeg jpeg jpg;\n application/x-javascript js;\n text/plain txt;\n text/x-component htc;\n text/mathml mml;\n image/svg+xml svg svgz;\n image/png png;\n image/x-icon ico;\n image/x-jng jng;\n image/vnd.wap.wbmp wbmp;\n application/java-archive jar war ear;\n application/mac-binhex40 hqx;\n application/pdf pdf;\n application/x-cocoa cco;\n application/x-java-archive-diff jardiff;\n application/x-java-jnlp-file jnlp;\n application/x-makeself run;\n application/x-perl pl pm;\n application/x-pilot prc pdb;\n application/x-rar-compressed rar;\n application/x-redhat-package-manager rpm;\n application/x-sea sea;\n application/x-shockwave-flash swf;\n application/x-stuffit sit;\n application/x-tcl tcl tk;\n application/x-x509-ca-cert der pem crt;\n application/x-xpinstall xpi;\n application/zip zip;\n application/octet-stream deb;\n application/octet-stream bin exe dll;\n application/octet-stream dmg;\n application/octet-stream eot;\n application/octet-stream iso img;\n application/octet-stream msi msp msm;\n audio/mpeg mp3;\n audio/x-realaudio ra;\n video/mpeg mpeg mpg;\n video/quicktime mov;\n video/x-flv flv;\n video/x-msvideo avi;\n video/x-ms-wmv wmv;\n video/x-ms-asf asx asf;\n video/x-mng mng;\n}\n"
|
||||
(:mime.types (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [],
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))))
|
||||
(is (= "user nginx;\nworker_processes 3;\nerror_log stdout info;\npid /var/log/nginx/nginx.pid;\nworker_rlimit_nofile 8192;\nevents {\n worker_connections 4096;\n}\nhttp {\n include /etc/nginx/mime.types;\n default_type application/octet-stream;\n log_format main '$remote_addr - $remote_user [$time_local] $status'\n '\"$request\" $body_bytes_sent \"$http_referer\"'\n '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n access_log stdout main;\n sendfile on;\n tcp_nopush on;\n keepalive_timeout 65;\n server_names_hash_bucket_size 128;\n include /etc/nginx/conf.d/website.conf;\n}\n"
|
||||
(:nginx.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [],
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))))
|
||||
(is (= {:apiVersion "v1",
|
||||
:kind "ConfigMap",
|
||||
:metadata {:labels {:app.kubernetes.part-of "test-io-website"},
|
||||
:namespace "test-io",
|
||||
:name "etc-nginx"}}
|
||||
(dissoc (cut/generate-nginx-configmap {:issuer "staging"
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"
|
||||
:unique-name "test.io",
|
||||
:redirects [],
|
||||
:forgejo-host "gitea.evilorg",
|
||||
:forgejo-repo "none",
|
||||
:branchname "mablain",
|
||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}) :data)))))
|
||||
|
||||
(deftest should-generate-nginx-service
|
||||
(is (= {:kind "Service",
|
||||
|
|
Loading…
Reference in a new issue