From 4a8e0be0531253a41a940da24c630853fbfa2d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Zielony?= Date: Fri, 20 Feb 2026 15:34:37 -0300 Subject: [PATCH] Revert "Merge pull request #9 from Identicum/feature/child-dir-demoapp-confs" This reverts commit dfd4e5d3e84fc8cc2443d5eaa20d676d8a7488c0, reversing changes made to cf799b600ef83bc53d992781121a43745075357c. --- conf/nginx.conf.template | 2 +- conf/server/demoapps.conf | 2 +- entrypoint.sh | 54 +++++++------------ localhost/demoapps/compose.yaml | 2 +- .../conf/{demoapp1 => }/demoapp1.conf | 0 .../conf/{demoapp2 => }/demoapp2.conf | 0 .../demoapps/conf/{type_2 => }/demoapp3.conf | 0 localhost/demoapps/conf/demoapp4.conf | 11 ---- localhost/demoapps/conf/type_1/demoapp1.conf | 12 ----- localhost/demoapps/conf/type_2/demoapp2.conf | 10 ---- localhost/demoapps/conf/type_3/PLACEHOLDER.md | 0 11 files changed, 23 insertions(+), 70 deletions(-) rename localhost/demoapps/conf/{demoapp1 => }/demoapp1.conf (100%) rename localhost/demoapps/conf/{demoapp2 => }/demoapp2.conf (100%) rename localhost/demoapps/conf/{type_2 => }/demoapp3.conf (100%) delete mode 100644 localhost/demoapps/conf/demoapp4.conf delete mode 100644 localhost/demoapps/conf/type_1/demoapp1.conf delete mode 100644 localhost/demoapps/conf/type_2/demoapp2.conf delete mode 100644 localhost/demoapps/conf/type_3/PLACEHOLDER.md diff --git a/conf/nginx.conf.template b/conf/nginx.conf.template index 780e3b0..7bd3b6f 100644 --- a/conf/nginx.conf.template +++ b/conf/nginx.conf.template @@ -52,7 +52,7 @@ http { lua_package_path '/var/ipax/lua/?.lua;;'; - include /var/ipax/conf/lua_shared_dict/**/*.conf; + include /var/ipax/conf/lua_shared_dict/*.conf; # bigger (chunked) cookie size to accomodate 'member_of' Claim large_client_header_buffers 8 32k; diff --git a/conf/server/demoapps.conf b/conf/server/demoapps.conf index e088687..2fe47a2 100644 --- a/conf/server/demoapps.conf +++ b/conf/server/demoapps.conf @@ -1,5 +1,5 @@ server { include /var/ipax/conf/default_vhost.conf; - include /var/ipax/conf/location_conf.d/**/*.conf; + include /var/ipax/conf/location_conf.d/*.conf; } \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 718ebc9..df43905 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,29 +1,24 @@ #!/bin/bash get_demoapps_list() { - find "${DEMOAPPS_VARIABLES_CONFIG_PATH}" -name "*.conf" -type f + local demoapps_list="" + for demoapp_conf_file in ${DEMOAPPS_VARIABLES_CONFIG_PATH}/*.conf; do + demoapp_name=$(basename "$demoapp_conf_file" .conf) + demoapps_list+="$demoapp_name " + done + # Trim trailing space and print + echo "${demoapps_list%% }" } delete_lua_shared_dict() { - echo "Deleting existing ${LUA_SHARED_DICT_PATH}/**/*.conf" - find "${LUA_SHARED_DICT_PATH}" -name "*.conf" -type f -delete + echo "Deleting existing ${LUA_SHARED_DICT_PATH}/*.conf" + rm -f ${LUA_SHARED_DICT_PATH}/*.conf } create_lua_shared_dict_file() { local demoapp_name="$1" - local demoapp_conf_file="$2" - local relative_path="${demoapp_conf_file#${DEMOAPPS_VARIABLES_CONFIG_PATH}/}" - local subdir - subdir=$(dirname "$relative_path") - local lua_shared_dict_path - if [ "$subdir" = "." ]; then - lua_shared_dict_path="${LUA_SHARED_DICT_PATH}/${demoapp_name}.conf" - else - lua_shared_dict_path="${LUA_SHARED_DICT_PATH}/${subdir}/${demoapp_name}.conf" - fi - + local lua_shared_dict_path="${LUA_SHARED_DICT_PATH}/${demoapp_name}.conf" echo "Creating ${lua_shared_dict_path}" - mkdir -p "$(dirname "$lua_shared_dict_path")" echo "lua_shared_dict ${demoapp_name}_jwks 1m;" > ${lua_shared_dict_path} echo "lua_shared_dict ${demoapp_name}_discovery 1m;" >> ${lua_shared_dict_path} echo "lua_shared_dict ${demoapp_name}_oidc_state 1m;" >> ${lua_shared_dict_path} @@ -33,25 +28,16 @@ create_lua_shared_dict_file() { } delete_multi_configs() { - echo "Deleting existing ${DEMOAPPS_CONFIG_PATH}/**/*.conf" - find "${DEMOAPPS_CONFIG_PATH}" -name "*.conf" -type f -delete + echo "Deleting existing ${DEMOAPPS_CONFIG_PATH}/*.conf" + rm -f ${DEMOAPPS_CONFIG_PATH}/*.conf } create_multi_config_file() { local demoapp_name="$1" - local demoapp_conf_file="$2" - local relative_path="${demoapp_conf_file#${DEMOAPPS_VARIABLES_CONFIG_PATH}/}" - local subdir=$(dirname "$relative_path") - local demoapps_config_path - if [ "$subdir" = "." ]; then - demoapps_config_path="${DEMOAPPS_CONFIG_PATH}/${demoapp_name}.conf" - else - demoapps_config_path="${DEMOAPPS_CONFIG_PATH}/${subdir}/${demoapp_name}.conf" - fi + local demoapps_config_path="${DEMOAPPS_CONFIG_PATH}/${demoapp_name}.conf" echo "Creating ${demoapps_config_path}" - mkdir -p "$(dirname "$demoapps_config_path")" cat /var/ipax/conf/demoapp_template.conf > ${demoapps_config_path} - sed -i "s#include /var/ipax/conf/default_variables.conf;#include /var/ipax/conf/default_variables.conf;\n include ${demoapp_conf_file};#g" "${demoapps_config_path}" + sed -i "s#include /var/ipax/conf/default_variables.conf;#include /var/ipax/conf/default_variables.conf;\n include ${DEMOAPPS_VARIABLES_CONFIG_PATH}/${demoapp_name}.conf;#g" ${demoapps_config_path} sed -i "s#location /#location /${demoapp_name}/#g" ${demoapps_config_path} sed -i "s#root /var/ipax/html/#alias /var/ipax/html/#g" ${demoapps_config_path} } @@ -78,12 +64,12 @@ if [ "$IPAX_MODE" = "demoapps" ]; then cp /var/ipax/conf/server/demoapps.conf /usr/local/openresty/nginx/conf/server.conf delete_lua_shared_dict delete_multi_configs - while IFS= read -r demoapp_conf_file; do - demoapp_name=$(basename "$demoapp_conf_file" .conf) - echo "Processing demoapp: '${demoapp_conf_file}'" - create_lua_shared_dict_file "${demoapp_name}" "${demoapp_conf_file}" - create_multi_config_file "${demoapp_name}" "${demoapp_conf_file}" - done < <(get_demoapps_list) + demoapps_list=$(get_demoapps_list) + for demoapp_name in $demoapps_list; do + echo "Processing demoapp: '${demoapp_name}'" + create_lua_shared_dict_file "${demoapp_name}" + create_multi_config_file "${demoapp_name}" + done echo "Finished processing demoapps" fi diff --git a/localhost/demoapps/compose.yaml b/localhost/demoapps/compose.yaml index fc32916..c972de2 100644 --- a/localhost/demoapps/compose.yaml +++ b/localhost/demoapps/compose.yaml @@ -3,7 +3,7 @@ name: ipax-demoapps services: idp: container_name: idp - image: ghcr.io/identicum/keycloak:26.1.0 + image: ghcr.io/identicum/keycloak:26.3 restart: always pull_policy: always ports: diff --git a/localhost/demoapps/conf/demoapp1/demoapp1.conf b/localhost/demoapps/conf/demoapp1.conf similarity index 100% rename from localhost/demoapps/conf/demoapp1/demoapp1.conf rename to localhost/demoapps/conf/demoapp1.conf diff --git a/localhost/demoapps/conf/demoapp2/demoapp2.conf b/localhost/demoapps/conf/demoapp2.conf similarity index 100% rename from localhost/demoapps/conf/demoapp2/demoapp2.conf rename to localhost/demoapps/conf/demoapp2.conf diff --git a/localhost/demoapps/conf/type_2/demoapp3.conf b/localhost/demoapps/conf/demoapp3.conf similarity index 100% rename from localhost/demoapps/conf/type_2/demoapp3.conf rename to localhost/demoapps/conf/demoapp3.conf diff --git a/localhost/demoapps/conf/demoapp4.conf b/localhost/demoapps/conf/demoapp4.conf deleted file mode 100644 index 6a89cf3..0000000 --- a/localhost/demoapps/conf/demoapp4.conf +++ /dev/null @@ -1,11 +0,0 @@ -set $ipax_app_name 'demoapp4'; -set $ipax_display_name 'DemoApp4'; -set $ipax_base_url 'http://demoapps/demoapp4'; - -set $oidc_discovery 'http://idp:8080/realms/demorealm/.well-known/openid-configuration'; -set $oidc_client_id 'demoapp4_client_id'; -set $oidc_use_pkce 'true'; -set $oidc_scope 'openid profile email'; -set $oidc_prompt 'none'; - -set $kc_delete_account_action 'delete_account'; \ No newline at end of file diff --git a/localhost/demoapps/conf/type_1/demoapp1.conf b/localhost/demoapps/conf/type_1/demoapp1.conf deleted file mode 100644 index a0e1e11..0000000 --- a/localhost/demoapps/conf/type_1/demoapp1.conf +++ /dev/null @@ -1,12 +0,0 @@ -set $ipax_app_name 'demoapp1'; -set $ipax_display_name 'DemoApp1'; -set $ipax_base_url 'http://demoapps/demoapp1'; - -set $oidc_discovery 'http://idp:8080/realms/demorealm/.well-known/openid-configuration'; -set $oidc_client_id 'demoapp1_client_id'; -set $oidc_client_secret 'demoapp1_client_secret'; - -set $kc_update_password_action 'UPDATE_PASSWORD'; -set $kc_update_email_action 'UPDATE_EMAIL'; - -set $kc_add_passkey_action 'webauthn-register-passwordless'; \ No newline at end of file diff --git a/localhost/demoapps/conf/type_2/demoapp2.conf b/localhost/demoapps/conf/type_2/demoapp2.conf deleted file mode 100644 index 300b03d..0000000 --- a/localhost/demoapps/conf/type_2/demoapp2.conf +++ /dev/null @@ -1,10 +0,0 @@ -set $ipax_app_name 'demoapp2'; -set $ipax_display_name 'DemoApp2'; -set $ipax_base_url 'http://demoapps/demoapp2'; - -set $oidc_discovery 'http://idp:8080/realms/demorealm/.well-known/openid-configuration'; -set $oidc_client_id 'demoapp2_client_id'; -set $oidc_use_pkce 'true'; -set $oidc_scope 'openid profile email'; - -set $kc_delete_account_action 'delete_account'; \ No newline at end of file diff --git a/localhost/demoapps/conf/type_3/PLACEHOLDER.md b/localhost/demoapps/conf/type_3/PLACEHOLDER.md deleted file mode 100644 index e69de29..0000000