feat(trino): just trino::cli to launch trino cli

This commit is contained in:
Masaki Yatsu
2025-10-21 00:46:13 +09:00
parent 337d52c2dc
commit 5905b1b264
2 changed files with 26 additions and 0 deletions

View File

@@ -379,3 +379,28 @@ admin-password:
echo "Cannot retrieve password: External Secrets not installed" echo "Cannot retrieve password: External Secrets not installed"
exit 1 exit 1
fi fi
# Connect to Trino CLI with OIDC authentication
cli user="":
#!/bin/bash
set -euo pipefail
if ! command -v trino &>/dev/null; then
echo "Error: trino command not found"
echo "Please install Trino CLI first"
exit 1
fi
TRINO_HOST="${TRINO_HOST}"
while [ -z "${TRINO_HOST}" ]; do
TRINO_HOST=$(gum input --prompt="Trino host (FQDN): " --width=100 \
--placeholder="e.g., trino.buun.dev")
done
TRINO_USER="{{ user }}"
if [ -z "${TRINO_USER}" ]; then
TRINO_USER=$(gum input --prompt="Username (Keycloak username): " --width=100 \
--placeholder="e.g., buun")
fi
echo "Connecting to Trino at https://${TRINO_HOST} as user: ${TRINO_USER}"
echo "OIDC authentication will open in your browser..."
trino --server "https://${TRINO_HOST}" \
--user "${TRINO_USER}" \
--external-authentication

View File

@@ -38,6 +38,7 @@ server:
http-server.authentication.oauth2.userinfo-url=https://{{ .Env.KEYCLOAK_HOST }}/realms/{{ .Env.KEYCLOAK_REALM }}/protocol/openid-connect/userinfo http-server.authentication.oauth2.userinfo-url=https://{{ .Env.KEYCLOAK_HOST }}/realms/{{ .Env.KEYCLOAK_REALM }}/protocol/openid-connect/userinfo
http-server.authentication.oauth2.client-id=${ENV:OAUTH2_CLIENT_ID} http-server.authentication.oauth2.client-id=${ENV:OAUTH2_CLIENT_ID}
http-server.authentication.oauth2.client-secret=${ENV:OAUTH2_CLIENT_SECRET} http-server.authentication.oauth2.client-secret=${ENV:OAUTH2_CLIENT_SECRET}
http-server.authentication.oauth2.principal-field=preferred_username
http-server.authentication.oauth2.scopes=openid,email,profile http-server.authentication.oauth2.scopes=openid,email,profile
http-server.authentication.oauth2.oidc.discovery=true http-server.authentication.oauth2.oidc.discovery=true
web-ui.authentication.type=oauth2 web-ui.authentication.type=oauth2