Skip to content

Commit

Permalink
use new httpserver
Browse files Browse the repository at this point in the history
  • Loading branch information
vdesabou committed Sep 15, 2023
1 parent e3d6ca8 commit a7d6f4c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ version: '3.5'
services:

httpserver:
image: vdesabou/http-sink-demo
build:
context: ../../connect/connect-http-sink/httpserver-oauth2
hostname: httpserver
container_name: httpserver
ports:
- "8080:8080"
environment:
SPRING_PROFILES_ACTIVE: 'oauth2'
- "9006:9006"

# https://github.com/shkoliar/docker-ngrok
ngrok:
Expand All @@ -22,7 +21,7 @@ services:
- httpserver
environment:
DOMAIN: httpserver
PORT: 8080
PORT: 9006
PROTOCOL: tcp
REGION: eu
AUTH_TOKEN: $NGROK_AUTH_TOKEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ log "Deleting fully managed connector $connector_name, it might fail..."
playground ccloud-connector delete --connector $connector_name
set -e

log "Set webserver to reply with 200"
curl -X PUT -H "Content-Type: application/json" --data '{"errorCode": 200}' http://localhost:9006

log "Creating fully managed connector"
playground ccloud-connector create-or-update --connector $connector_name << EOF
{
Expand All @@ -85,14 +88,14 @@ playground ccloud-connector create-or-update --connector $connector_name << EOF
"kafka.api.secret": "$CLOUD_SECRET",
"topics": "http-topic",
"input.data.format": "AVRO",
"http.api.url": "http://$NGROK_HOSTNAME:$NGROK_PORT/api/messages",
"http.api.url": "http://$NGROK_HOSTNAME:$NGROK_PORT",
"behavior.on.error": "fail",
"tasks.max" : "1",
"auth.type": "OAUTH2",
"oauth2.token.url": "http://$NGROK_HOSTNAME:$NGROK_PORT/oauth/token",
"oauth2.client.id": "kc-client",
"oauth2.client.secret": "kc-secret",
"oauth2.client.mode": "header"
"oauth2.client.id": "confidentialApplication",
"oauth2.client.secret": "topSecret",
"oauth2.token.property": "accessToken"
}
EOF
wait_for_ccloud_connector_up $connector_name 300
Expand All @@ -106,3 +109,11 @@ log "Do you want to delete the fully managed connector $connector_name ?"
check_if_continue

playground ccloud-connector delete --connector $connector_name


# create token, see https://github.com/pedroetb/node-oauth2-server-example#with-client_credentials-grant-1
# token=$(curl -X POST \
# http://localhost:9006/oauth/token \
# -H 'Content-Type: application/x-www-form-urlencoded' \
# -H 'Authorization: Basic Y29uZmlkZW50aWFsQXBwbGljYXRpb246dG9wU2VjcmV0' \
# -d 'grant_type=client_credentials&scope=any' | jq -r '.accessToken')
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ log "Deleting fully managed connector $connector_name, it might fail..."
playground ccloud-connector delete --connector $connector_name
set -e

log "Set webserver to reply with 200"
curl -X PUT -H "Content-Type: application/json" --data '{"errorCode": 200}' http://localhost:9006

log "Creating fully managed connector"
playground ccloud-connector create-or-update --connector $connector_name << EOF
{
Expand Down

0 comments on commit a7d6f4c

Please sign in to comment.