Skip to content

Commit

Permalink
Read the token properly
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Ok <[email protected]>
  • Loading branch information
aliok committed Sep 20, 2024
1 parent 08f8689 commit 74b961c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backstage/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ catalog:
providers:
knativeEventMesh:
dev:
token: '${KNATIVE_EVENT_MESH_TOKEN}'
baseUrl: '${KNATIVE_EVENT_MESH_BACKEND}'
token: ${KNATIVE_EVENT_MESH_TOKEN}
baseUrl: ${KNATIVE_EVENT_MESH_BACKEND}
schedule: # optional; same options as in TaskScheduleDefinition
# supports cron, ISO duration, "human duration" as used in code
frequency: { minutes: 1 }
Expand Down
4 changes: 2 additions & 2 deletions backstage/plugins/knative-event-mesh-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ curl -k -H "Authorization: Bearer $KUBE_SA_TOKEN" -X GET "${KUBE_API_SERVER_URL}
Run a second quick check to see if the token works with the backend
```bash
KNATIVE_EVENT_MESH_BACKEND=http://localhost:8080 # or the URL of the backend
export KNATIVE_EVENT_MESH_BACKEND=http://localhost:8080 # or the URL of the backend
export KUBE_SA_TOKEN=$(kubectl get secret my-eventmesh-backend-secret -o jsonpath='{.data.token}' | base64 --decode)
curl -k -H "Authorization: Bearer $KUBE_SA_TOKEN" -X GET "${KNATIVE_EVENT_MESH_BACKEND}" | json_pp
# Should see the response from the backend such as
Expand Down Expand Up @@ -226,7 +226,7 @@ To install on the new backend system, add the following into the `packages/backe
```ts title=packages/backend/index.ts
import { createBackend } from '@backstage/backend-defaults';
const backend = const backend = createBackend();
const backend = createBackend();
// Other plugins/modules
Expand Down
4 changes: 2 additions & 2 deletions backstage/plugins/knative-event-mesh-backend/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ catalog:
providers:
knativeEventMesh:
dev:
token: '${KNATIVE_EVENT_MESH_TOKEN}'
baseUrl: '${KNATIVE_EVENT_MESH_BACKEND}'
token: ${KNATIVE_EVENT_MESH_TOKEN}
baseUrl: ${KNATIVE_EVENT_MESH_BACKEND}
schedule: # optional; same options as in TaskScheduleDefinition
# supports cron, ISO duration, "human duration" as used in code
frequency: { minutes: 1 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function readKnativeEventMeshProviderConfigs(config:Config):KnativeEventM

function readKnativeEventMeshProviderConfig(id:string, config:Config):KnativeEventMeshProviderConfig {
const baseUrl = config.getString('baseUrl');
const token = config.getString('token');

const schedule = config.has('schedule')
? readTaskScheduleDefinitionFromConfig(config.getConfig('schedule'))
Expand All @@ -28,5 +29,6 @@ function readKnativeEventMeshProviderConfig(id:string, config:Config):KnativeEve
id,
baseUrl,
schedule,
token,
};
}

0 comments on commit 74b961c

Please sign in to comment.