-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from plivo/SMS-5025
SMS-5025: Add Requester IP to Get and List Messages
- Loading branch information
Showing
12 changed files
with
132 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,6 @@ Thumbs.db | |
|
||
# rider | ||
.idea | ||
|
||
# test files | ||
dotnet-sdk-test/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM ubuntu:latest | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN apt-get update && apt-get install -y wget git vim | ||
RUN apt-get install -y apt-transport-https | ||
|
||
# Install dotnet sdk and runtime: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install | ||
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh | ||
RUN chmod +x ./dotnet-install.sh | ||
RUN ./dotnet-install.sh --version latest | ||
RUN rm ./dotnet-install.sh | ||
|
||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1 | ||
ENV DOTNET_ROOT /root/.dotnet | ||
ENV PATH $PATH:/root/.dotnet:/root/.dotnet/tools | ||
RUN dotnet --info | ||
|
||
# Copy setup script | ||
COPY setup_sdk.sh /usr/src/app/ | ||
RUN chmod a+x /usr/src/app/setup_sdk.sh | ||
|
||
ENTRYPOINT [ "/usr/src/app/setup_sdk.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,4 @@ | ||
.PHONY: build | ||
|
||
build: | ||
docker-compose up --build --remove-orphans |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
dotnetSDK: | ||
build: | ||
context: . | ||
image: dotnetsdk | ||
container_name: dotnetSDK | ||
environment: | ||
- PLIVO_AUTH_ID=${PLIVO_AUTH_ID} | ||
- PLIVO_AUTH_TOKEN=${PLIVO_AUTH_TOKEN} | ||
- PLIVO_API_DEV_HOST=${PLIVO_API_DEV_HOST} | ||
- PLIVO_API_PROD_HOST=${PLIVO_API_PROD_HOST} | ||
volumes: | ||
- .:/usr/src/app | ||
stdin_open: true | ||
tty: true |
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,49 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
testDir="dotnet-sdk-test" | ||
GREEN="\033[0;32m" | ||
NC="\033[0m" | ||
|
||
if [ ! $PLIVO_API_PROD_HOST ] || [ ! $PLIVO_API_DEV_HOST ] || [ ! $PLIVO_AUTH_ID ] || [ ! $PLIVO_AUTH_TOKEN ]; then | ||
echo "Environment variables not properly set! Please refer to Local Development section in README!" | ||
exit 126 | ||
fi | ||
|
||
cd /usr/src/app | ||
|
||
echo "Setting plivo-api endpoint to dev..." | ||
find /usr/src/app/src/Plivo/Client -type f -exec sed -i "s/$PLIVO_API_PROD_HOST/$PLIVO_API_DEV_HOST/g" {} \; | ||
|
||
if [ ! -d $testDir ]; then | ||
echo "Creating test dir..." | ||
mkdir -p $testDir | ||
# Fix for library issue: See Dotnet section of https://plivo-team.atlassian.net/wiki/spaces/SMSTEAM/pages/3581313044/Local+Setup+for+SDKs | ||
sed -i '/Nerdbank.GitVersioning/ { | ||
n; | ||
/Version/ { | ||
s/<Version>[^<]*<\/Version>/<Version>3.4.244<\/Version>/g; | ||
} | ||
}' Directory.Build.props | ||
sed -i '/Plivo.NetCore.Test/,+1d' Plivo.sln | ||
fi | ||
|
||
if [ ! -f $testDir/*.csproj ]; then | ||
echo "Initialising test project" | ||
cd $testDir | ||
dotnet new console | ||
dotnet add package Plivo | ||
sed -i 's+<PackageReference Include="Plivo".*>+<ProjectReference Include="/usr/src/app/src/Plivo/Plivo.csproj"/>+' $testDir.csproj | ||
echo "using Plivo;" > Program.cs | ||
dotnet restore | ||
fi | ||
|
||
echo -e "\n\nSDK setup complete!" | ||
echo "To test your changes:" | ||
echo -e "\t1. Add your test code to <path_to_cloned_sdk>/$testDir/Program.cs on host (or /usr/src/app/$testDir/Program.cs in the container)" | ||
echo -e "\t2. Run a terminal in the container using: $GREEN docker exec -it $HOSTNAME /bin/bash$NC" | ||
echo -e "\t3. Navigate to the test directory: $GREEN cd /usr/src/app/$testDir$NC" | ||
echo -e "\t4. Run your test file: $GREEN dotnet run Program.cs$NC" | ||
|
||
# To keep the container running post setup | ||
/bin/bash |
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
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
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