generated from pagopa/template-java-microservice
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spontaneous payment improvements (#3)
* rebase * added cosmos config Co-authored-by: aacitelli <[email protected]>
- Loading branch information
1 parent
182e9f0
commit b9ecba9
Showing
14 changed files
with
142 additions
and
46 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 |
---|---|---|
|
@@ -2,4 +2,5 @@ target/**/* | |
.vscode | ||
/.idea/ | ||
emulatorcert.crt | ||
.env | ||
*.env | ||
**/*paDemandPaymentNoticeRequest.xml |
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
11 changes: 5 additions & 6 deletions
11
src/main/java/it/gov/pagopa/spontaneouspayment/controller/impl/PaymentsController.java
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
|
||
# set -e | ||
|
||
# force delete image and container of MS AZ Cosmos DB Emulator | ||
docker container rm -f test-linux-emulator | ||
# force delete image and container of MS AZ Cosmos DB Emulator | ||
docker image rm -f mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest | ||
|
||
PORT=$1 | ||
JVM_HOME=$2 | ||
|
||
# Main ... | ||
if [ -z "$PORT" ] | ||
then | ||
PORT=8081 | ||
echo "CosmosDB starting on DEFAULT port $PORT" | ||
else | ||
echo "CosmosDB starting on specific port $PORT" | ||
fi | ||
|
||
if [ -z "$JVM_HOME" ] | ||
then | ||
JVM_HOME=$JAVA_HOME | ||
echo "Using DEFAULT JAVA_HOME $JVM_HOME" | ||
else | ||
echo "Using custom JAVA_HOME $JVM_HOME" | ||
fi | ||
|
||
|
||
# Azure Cosmos DB Emulator | ||
URL="https://localhost:$PORT/_explorer/index.html" | ||
|
||
ipaddr=$(ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | head -n 1) | ||
echo "Using ${ipaddr} for CosmosDB configuration..." | ||
|
||
docker pull mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator | ||
|
||
docker run \ | ||
--detach \ | ||
--publish $PORT:8081 \ | ||
--publish 10251-10254:10251-10254 \ | ||
--memory 3g --cpus=2.0 \ | ||
--name=test-linux-emulator \ | ||
--env AZURE_COSMOS_EMULATOR_PARTITION_COUNT=10 \ | ||
--env AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true \ | ||
--env AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=$ipaddr \ | ||
--interactive \ | ||
--tty \ | ||
mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator | ||
|
||
echo -n "CosmosDB starting..." | ||
cosmos_started="`docker logs test-linux-emulator | grep -wc Started`" | ||
echo -n $cosmos_started | ||
# check cosmos is UP | ||
while [ "$cosmos_started" != "12" ] | ||
do | ||
sleep 3 | ||
echo -n "." | ||
cosmos_started=`docker logs test-linux-emulator | grep -wc Started` | ||
echo -n $cosmos_started | ||
done | ||
|
||
echo "!!! STARTED !!!" | ||
|
||
echo "Setting certificate..." | ||
|
||
curl -k "https://${ipaddr}:${PORT}/_explorer/emulator.pem" > emulatorcert.crt | ||
|
||
# add keychain accesss | ||
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain emulatorcert.crt | ||
|
||
# add jvm trust-store | ||
keystore_alias="cosmoskeystore" | ||
echo "Remember, the keystore passowrd is: changeit" | ||
sudo keytool -delete -alias $keystore_alias -keystore "${JAVA_HOME}/lib/security/cacerts" | ||
sudo keytool -trustcacerts -keystore "${JAVA_HOME}/lib/security/cacerts" -storepass changeit -importcert -alias $keystore_alias -file emulatorcert.crt | ||
|
||
echo "Setting certificate...done." | ||
|
||
open $URL |