-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
212 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ MODULES= \ | |
server \ | ||
database-migration \ | ||
waker \ | ||
debugger \ | ||
|
||
|
||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# For more information on configuration, see: | ||
# * Official English Documentation: http://nginx.org/en/docs/ | ||
# * Official Russian Documentation: http://nginx.org/ru/docs/ | ||
|
||
worker_processes auto; | ||
error_log /dev/stdout info; | ||
|
||
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. | ||
include /usr/share/nginx/modules/*.conf; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /dev/stdout main; | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
# Load modular configuration files from the /etc/nginx/conf.d directory. | ||
# See http://nginx.org/en/docs/ngx_core_module.html#include | ||
# for more information. | ||
include /etc/nginx/conf.d/*.conf; | ||
|
||
server { | ||
listen 8080; | ||
server_name _; | ||
root /public; | ||
absolute_redirect off; | ||
|
||
error_page 404 =200 /index.html; | ||
|
||
location /endpoints/ { | ||
alias /endpoints/; | ||
} | ||
|
||
location / { | ||
index index.html; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -x | ||
set -o pipefail | ||
|
||
: "${API_URL:=http://localhost:8011}" | ||
|
||
: "${KEYCLOAK_URL:=http://localhost:8012}" | ||
: "${REALM:=doppelgaenger}" | ||
: "${CLIENT_ID:=api}" | ||
|
||
: "${BACKEND_JSON:="{}"}" | ||
: "${BACKEND_JSON_FILE:=/etc/config/login/backend.json}" | ||
|
||
echo "Setting backend information:" | ||
|
||
if [ -f "$BACKEND_JSON_FILE" ]; then | ||
echo "Using base config from file: $BACKEND_JSON_FILE" | ||
BACKEND_JSON="$(cat "$BACKEND_JSON_FILE")" | ||
fi | ||
|
||
# inject backend URL | ||
echo "$BACKEND_JSON" | jq --arg value "$API_URL" '. + {api: $value}' | tee /endpoints/backend.json | ||
|
||
# inject oauth2 information | ||
jq --arg value "$CLIENT_ID" '.keycloak += {clientId: $value}' < /endpoints/backend.json | tee /endpoints/backend.json.tmp | ||
mv /endpoints/backend.json.tmp /endpoints/backend.json | ||
jq --arg value "$KEYCLOAK_URL" '.keycloak += {url: $value}' < /endpoints/backend.json | tee /endpoints/backend.json.tmp | ||
mv /endpoints/backend.json.tmp /endpoints/backend.json | ||
jq --arg value "$REALM" '.keycloak += {realm: $value}' < /endpoints/backend.json | tee /endpoints/backend.json.tmp | ||
mv /endpoints/backend.json.tmp /endpoints/backend.json | ||
|
||
echo "Final backend information:" | ||
echo "---" | ||
cat /endpoints/backend.json | ||
echo "---" | ||
|
||
exec /usr/sbin/nginx -g "daemon off;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters