Skip to content

Commit 7545c4e

Browse files
committed
[gis-platform] snap-proof configure script
ref: https://forum.snapcraft.io/t/jq-cant-read-some-files/17835/3
1 parent 07fc703 commit 7545c4e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

charts/gis-platform/gis-platform-config/configure.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ function configure() {
7373
exit 1
7474
fi
7575

76-
create_or_update_layer "RemoteTileService" "$(jq --arg url "${tiles_api_url}" '.urlFormat=$url' layer/2gis.json)"
77-
create_or_update_layer "RemoteTileService" "$(jq --arg url "${traffic_url}" '.urlFormat=$url' layer/2gis_traffic.json)"
76+
create_or_update_layer "RemoteTileService" "$(cat layer/2gis.json | jq --arg url "${tiles_api_url}" '.urlFormat=$url')"
77+
create_or_update_layer "RemoteTileService" "$(cat layer/2gis_traffic.json | jq --arg url "${traffic_url}" '.urlFormat=$url')"
7878
create_or_update_layer "LocalTileService" "$(cat layer/satellite_imagery.json)"
7979

8080
echo "Configuring Map"
@@ -84,15 +84,15 @@ function configure() {
8484
echo "Configuring Admin panel"
8585
$CURL -XPOST -H 'Content-Type: application/json' -d @configuration/AdminConfig.json "$GIS_PLATFORM_URL/sp/settings?urlPath=/admin"
8686
echo "Configuring map sharing"
87-
jq --arg url "${GIS_PLATFORM_URL#http*://}" '.connection.ws_url=$url+"/sp/ws/"' configuration/SharedConfig.json | $CURL -XPOST -H 'Content-Type: application/json' -d @- "$GIS_PLATFORM_URL/sp/settings?urlPath=/shared"
87+
cat configuration/SharedConfig.json | jq --arg url "${GIS_PLATFORM_URL#http*://}" '.connection.ws_url=$url+"/sp/ws/"' | $CURL -XPOST -H 'Content-Type: application/json' -d @- "$GIS_PLATFORM_URL/sp/settings?urlPath=/shared"
8888

89-
layer_names=$(jq --slurp --compact-output '[ .[].name ]' layer/*.json)
89+
layer_names=$(cat layer/*.json | jq --slurp --compact-output '[ .[].name ]')
9090
echo "Share all basemaps: $layer_names"
9191
$CURL -XPOST -H 'Content-Type: application/json-patch+json' -d "$layer_names" "$GIS_PLATFORM_URL/sp/resources/layers/shareAll"
9292

9393
echo "Setting autoshared list for all basemaps"
9494
for layer in layer/*.json; do
95-
data=$(jq --compact-output '{name: .name, type: "layer"}' $layer)
95+
data=$(cat $layer | jq --compact-output '{name: .name, type: "layer"}')
9696
$CURL -XPOST -H 'Content-Type: application/json-patch+json' -d "$data" "$GIS_PLATFORM_URL/sp/autosharedList"
9797
done
9898
}
@@ -101,7 +101,7 @@ function configure() {
101101

102102
function dump_configuration {
103103
for layer in layer/*.json; do
104-
name=$(jq --raw-output .name $layer)
104+
name=$(cat $layer | jq --raw-output .name)
105105
echo "Fetching layer $name"
106106
get_layer_config $name | jq . > "$TMPDIR/layer_${name}.json"
107107
done
@@ -118,7 +118,7 @@ function dump_configuration {
118118
function config_diff() {
119119
# dump_configuration
120120
for layer in layer/*.json; do
121-
name=$(jq --raw-output .name $layer)
121+
name=$(cat $layer | jq --raw-output .name)
122122
diff -urBb $layer $TMPDIR/layer_$name.json
123123
done
124124
for config in configuration/*.json; do

0 commit comments

Comments
 (0)