21 lines
		
	
	
		
			805 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			805 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
#!/command/with-contenv bash
 | 
						|
set -euo pipefail
 | 
						|
OPTIONS_FILE=/data/options.json
 | 
						|
if [ ! -f "$OPTIONS_FILE" ]; then
 | 
						|
  echo "[cont-init] No options.json, skipping dashboards plugin install"
 | 
						|
  exit 0
 | 
						|
fi
 | 
						|
if ! jq -e '.plugins // [] | length > 0' "$OPTIONS_FILE" >/dev/null 2>&1; then
 | 
						|
  echo "[cont-init] No dashboards plugins configured, skipping"
 | 
						|
  exit 0
 | 
						|
fi
 | 
						|
echo "[cont-init] Installing dashboards plugins from options.json"
 | 
						|
jq -r '.plugins[]' "$OPTIONS_FILE" | while read -r plugin; do
 | 
						|
  echo "[cont-init] Installing dashboards plugin: $plugin"
 | 
						|
  if /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin install --allow-root "$plugin"; then
 | 
						|
    echo "[cont-init] Installed dashboards plugin $plugin"
 | 
						|
  else
 | 
						|
    echo "[cont-init] Failed to install dashboards plugin $plugin (continuing)"
 | 
						|
  fi
 | 
						|
done
 |