Skip to content

Commit

Permalink
chore: add ui insecure option
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsaporiti committed Jun 14, 2024
1 parent 2b9007c commit 2daa50e
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env-ui.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ ISSUER_UI_BUILD_TAG=
ISSUER_UI_WARNING_MESSAGE=
ISSUER_UI_IPFS_GATEWAY_URL=https://ipfs.io
ISSUER_UI_SCHEMA_EXPLORER_AND_BUILDER_URL=https://schema-builder.polygonid.me
ISSUER_UI_INSECURE=false
58 changes: 58 additions & 0 deletions ui/deployment/nginx_insecure.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
server {
listen 80;
server_name localhost;

location /health {
access_log off;
add_header 'Content-Type' 'application/json';
return 200 '{"status":"ok"}';
}

location ~* "^/credentials/scan-(issued|link)/[0-9a-f]{8}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{4}\b-[0-9a-f]{12}" {
auth_basic "off";
root /usr/share/nginx/html;
index index.html;
try_files $uri /index.html =404;
include uwsgi_params;
}

location /assets {
auth_basic "off";
root /usr/share/nginx/html;
try_files $uri /index.html =404;
include uwsgi_params;
}

location /favicon.png {
auth_basic "off";
root /usr/share/nginx/html;
try_files $uri /index.html =404;
include uwsgi_params;
}

location /images {
auth_basic "off";
root /usr/share/nginx/html;
try_files $uri /index.html =404;
include uwsgi_params;
}

location /fonts {
auth_basic "off";
root /usr/share/nginx/html;
try_files $uri /index.html =404;
include uwsgi_params;
}

location / {
root /usr/share/nginx/html;
index index.html;
# Redirect all requests to index.html
try_files $uri /index.html =404;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
13 changes: 10 additions & 3 deletions ui/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ echo "VITE_SCHEMA_EXPLORER_AND_BUILDER_URL=$ISSUER_UI_SCHEMA_EXPLORER_AND_BUILDE
cd /app && npm run build

# Copy nginx config
cp deployment/nginx.conf /etc/nginx/conf.d/default.conf
echo $ISSUER_UI_AUTH_USERNAME
echo $ISSUER_UI_AUTH_PASSWORD
htpasswd -c -b /etc/nginx/.htpasswd $ISSUER_UI_AUTH_USERNAME $ISSUER_UI_AUTH_PASSWORD
cat /etc/nginx/.htpasswd

# shellcheck disable=SC2039
if [ "${ISSUER_UI_INSECURE}" == "true" ]; then
cp deployment/nginx_insecure.conf /etc/nginx/conf.d/default.conf
else
cp deployment/nginx.conf /etc/nginx/conf.d/default.conf
htpasswd -c -b /etc/nginx/.htpasswd $ISSUER_UI_AUTH_USERNAME $ISSUER_UI_AUTH_PASSWORD
cat /etc/nginx/.htpasswd
fi


# Copy app dist
cp -r /app/dist/. /usr/share/nginx/html
Expand Down

0 comments on commit 2daa50e

Please sign in to comment.