This repository has been archived by the owner on Aug 25, 2024. It is now read-only.
forked from LangStream/langstream
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Helper scripts to set the REACT_APP environment variables (LangStream…
- Loading branch information
1 parent
bcb1ea9
commit ab56f55
Showing
4 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
examples/applications/react-chatbot-ui/get-env-vars-from-app.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright DataStax, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
|
||
# Receive YAML output from a pipe | ||
YAML_OUTPUT=$(cat) | ||
|
||
# Extract necessary values | ||
APP=$(echo "$YAML_OUTPUT" | grep "application-id" | awk '{print $2}' | tr -d '"') | ||
|
||
# Extract IDs for CONSUMER and PRODUCER based on the type | ||
CONSUMER=$(echo "$YAML_OUTPUT" | awk '/- id: / {id=$3} /type: "consume"/ {print id}' | tr -d '"') | ||
PRODUCER=$(echo "$YAML_OUTPUT" | awk '/- id: / {id=$3} /type: "produce"/ {print id}' | tr -d '"') | ||
|
||
# Set environment variables | ||
export REACT_APP_APP=$APP | ||
export REACT_APP_CONSUMER=$CONSUMER | ||
export REACT_APP_PRODUCER=$PRODUCER | ||
|
||
# Print environment variables | ||
echo "export REACT_APP_APP=$REACT_APP_APP" | ||
echo "export REACT_APP_CONSUMER=$REACT_APP_CONSUMER" | ||
echo "export REACT_APP_PRODUCER=$REACT_APP_PRODUCER" |
34 changes: 34 additions & 0 deletions
34
examples/applications/react-chatbot-ui/get-env-vars-from-profile.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright DataStax, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
|
||
# Receive YAML output from a pipe | ||
YAML_OUTPUT=$(cat) | ||
|
||
# Extract necessary values | ||
WEBSOCKET_URL=$(echo "$YAML_OUTPUT" | grep "apiGatewayUrl:" | awk '{print $2}' | tr -d '"') | ||
TENANT=$(echo "$YAML_OUTPUT" | grep "tenant:" | awk '{print $2}' | tr -d '"') | ||
CREDENTIALS=$(echo "$YAML_OUTPUT" | grep "token:" | awk '{print $2}' | tr -d '"') | ||
|
||
# Set environment variables | ||
export REACT_APP_WEBSOCKET_URL=$WEBSOCKET_URL | ||
export REACT_APP_TENANT=$TENANT | ||
export REACT_APP_CREDENTIALS=$CREDENTIALS | ||
|
||
# Print environment variables | ||
echo "export REACT_APP_WEBSOCKET_URL=$REACT_APP_WEBSOCKET_URL" | ||
echo "export REACT_APP_TENANT=$REACT_APP_TENANT" |