File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,13 +3,15 @@ FROM python:3.13-slim@sha256:6544e0e002b40ae0f59bc3618b07c1e48064c4faed3a15ae2fb
33# Install dependencies
44RUN apt-get update && apt-get install -y --no-install-recommends \
55 curl \
6+ jq \
67 ca-certificates \
78 && rm -rf /var/lib/apt/lists/*
89
910WORKDIR /home/tinybird
1011
1112# Install Tinybird using the standard installation script
1213COPY handleLogin.sh /usr/local/bin/tinybird-login
14+ COPY getTokens.sh /usr/local/bin/get-tokens
1315COPY tb-wrapper /usr/local/bin/tb-wrapper
1416
1517RUN curl https://tinybird.co | sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Get token from .tinyb JSON file
4+ USER_TOKEN=$( jq -r ' .token' .tinyb)
5+ echo " User token: $USER_TOKEN "
6+
7+ if [ -z " $USER_TOKEN " ] || [ " $USER_TOKEN " = " null" ]; then
8+ echo " Error: Could not find token in .tinyb file"
9+ exit 1
10+ fi
11+
12+ # Get host from .tinyb JSON file
13+ HOST=$( jq -r ' .host' .tinyb)
14+ echo " Host: $HOST "
15+
16+ if [ -z " $HOST " ] || [ " $HOST " = " null" ]; then
17+ echo " Error: Could not find host in .tinyb file"
18+ exit 1
19+ fi
20+
21+ # Get id from .tinyb JSON file
22+ WORKSPACE_ID=$( jq -r ' .id' .tinyb)
23+ echo " Workspace ID: $WORKSPACE_ID "
24+
25+ if [ -z " $WORKSPACE_ID " ] || [ " $WORKSPACE_ID " = " null" ]; then
26+ echo " Error: Could not find id in .tinyb file"
27+ exit 1
28+ fi
29+
30+ # Make GET request to tokens endpoint and parse response
31+ RESPONSE=$( curl -s -X GET \
32+ " $HOST /v0/tokens" \
33+ -H " Authorization: Bearer $USER_TOKEN " )
34+
35+ # Parse tokens from response
36+ ADMIN_TOKEN=$( echo " $RESPONSE " | jq -r ' .tokens[] | select(.name == "admin token") | .token' )
37+ TRACKER_TOKEN=$( echo " $RESPONSE " | jq -r ' .tokens[] | select(.name == "tracker") | .token' )
38+
39+ # Echo the tokens as proof of concept
40+ echo " Admin token: $ADMIN_TOKEN "
41+ echo " Tracker token: $TRACKER_TOKEN "
You can’t perform that action at this time.
0 commit comments