generated from arafkarsh/ms-springboot-324-java-22-jakarta-ee-10
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathencrypt
executable file
·30 lines (24 loc) · 948 Bytes
/
encrypt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# -------------------------------------------------------------------------------------------
# @author: Araf Karsh Hamid, (c) Copyright 2024
# -------------------------------------------------------------------------------------------
jasypt=libs/jasypt-1.9.3.jar
# Name of the environment variable
ENV_VAR="JASYPT_ENCRYPTOR_PASSWORD"
# For Java 17+
echo Using Java 17+ Comptible code
java -cp $jasypt src/main/java/io/fusion/air/microservice/security/utils/Encrypt17.java $1 $2
# For Java 23
#echo Java 23 Comptible Code
#java --enable-preview -cp $jasypt Encrypt.java $1 $2
# Check if the second argument ($2) is provided and valid (not empty)
if [ -n "$2" ]; then
# Check if the environment variable is set
if [ -z "${!ENV_VAR}" ]; then
echo "Environment variable $ENV_VAR is not set."
echo "Setting it to: $2"
export $ENV_VAR="$2"
else
echo "Environment variable $ENV_VAR is already set"
fi
fi