Updated Setup script workflows
This commit is contained in:
parent
840ddb6749
commit
2cff7b90a3
|
@ -1 +1,5 @@
|
||||||
echo "Hello from API"
|
#!/bin/bash
|
||||||
|
|
||||||
|
source "packages/config-store/.env"
|
||||||
|
echo "Fetching API Key with env file from Config Store"
|
||||||
|
wget --user $BASIC_USERNAME --password $BASIC_PASSWORD http://127.0.0.1:$CS_PORT/private/api.env -O packages/api/.env
|
|
@ -0,0 +1,3 @@
|
||||||
|
USERNAME=admin
|
||||||
|
PASSWORD=pass
|
||||||
|
PORT=0000
|
|
@ -0,0 +1,6 @@
|
||||||
|
Dockerfile
|
||||||
|
.env
|
||||||
|
public/*
|
||||||
|
private/*
|
||||||
|
!public/.gitkeep
|
||||||
|
!private/.gitkeep
|
|
@ -8,5 +8,6 @@ RUN go get
|
||||||
|
|
||||||
RUN go build
|
RUN go build
|
||||||
|
|
||||||
CMD ["config-store"]
|
EXPOSE 0000
|
||||||
|
|
||||||
|
CMD ["/app/config-store"]
|
|
@ -70,7 +70,7 @@ func main() {
|
||||||
|
|
||||||
app.Static("/private", "private")
|
app.Static("/private", "private")
|
||||||
|
|
||||||
port := goDotEnvVariable("PORT")
|
port := goDotEnvVariable("CS_PORT")
|
||||||
if port == "" {
|
if port == "" {
|
||||||
port = "3000"
|
port = "3000"
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,7 @@ echo "BASIC_USERNAME=$username" >> $ENV_PATH
|
||||||
echo "BASIC_PASSWORD=$password" >> $ENV_PATH
|
echo "BASIC_PASSWORD=$password" >> $ENV_PATH
|
||||||
echo "PORT=$port" >> $ENV_PATH
|
echo "PORT=$port" >> $ENV_PATH
|
||||||
|
|
||||||
|
sed "s/0000/$port/g" packages/config-store/Dockerfile.example > packages/config-store/Dockerfile
|
||||||
|
|
||||||
# Echo a message to confirm the file has been saved
|
# Echo a message to confirm the file has been saved
|
||||||
echo "Configuration saved to packages/config-store/.env"
|
echo "Configuration saved to packages/config-store/.env"
|
||||||
|
|
|
@ -12,21 +12,28 @@ echo ""
|
||||||
echo "This script will setup .env all the packages in the $PACKAGES_FOLDER folder."
|
echo "This script will setup .env all the packages in the $PACKAGES_FOLDER folder."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Ask If setting up for the first time, then only setup "config-store" package
|
||||||
|
read -p "Is this the first time you are setting up the project? [y/N] " -n 1 -r
|
||||||
|
echo ""
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
echo "${bold} Setting up config-store ${normal}"
|
||||||
|
bash packages/config-store/setup.sh
|
||||||
|
echo ""
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Iterate through all packages
|
# Iterate through all packages
|
||||||
for package in $PACKAGES_FOLDER/*; do
|
for package in $PACKAGES_FOLDER/*; do
|
||||||
# Check if package is a directory
|
# Check if package is a directory
|
||||||
|
echo "${bold} Setting up $package ${normal}"
|
||||||
echo "${bold} Setting up $package ${normal}"
|
|
||||||
|
|
||||||
if [ -d "$package" ]; then
|
if [ -d "$package" ]; then
|
||||||
|
|
||||||
# Check if .setup file is present. If not, skip package
|
# Check if .setup file is present. If not, skip package
|
||||||
if [ ! -f "$package/.setup" ]; then
|
if [ ! -f "$package/.setup" ]; then
|
||||||
echo "Skipping $package"
|
echo "Skipping $package"
|
||||||
echo ""
|
echo ""
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if .env file presen. If present, ask user if he wants to overwrite it
|
# Check if .env file presen. If present, ask user if he wants to overwrite it
|
||||||
if [ -f "$package/.env" ]; then
|
if [ -f "$package/.env" ]; then
|
||||||
read -p "Overwrite $package/.env? [y/N] " -n 1 -r
|
read -p "Overwrite $package/.env? [y/N] " -n 1 -r
|
||||||
|
@ -36,10 +43,8 @@ for package in $PACKAGES_FOLDER/*; do
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod +x "$package/setup.sh"
|
chmod +x "$package/setup.sh"
|
||||||
bash "$package/setup.sh"
|
bash "$package/setup.sh"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue