Added Setup Scripts

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2023-01-13 00:30:53 +05:30
parent 5f5ac613d7
commit 840ddb6749
Signed by: bravo68web
GPG Key ID: F5671FD7BCB9917A
11 changed files with 84 additions and 2 deletions

0
packages/api/.setup Normal file
View File

1
packages/api/setup.sh Executable file
View File

@ -0,0 +1 @@
echo "Hello from API"

1
packages/cli/setup.sh Executable file
View File

@ -0,0 +1 @@
echo "Hello from CLI"

View File

View File

@ -0,0 +1,12 @@
FROM golang:alpine3.16
WORKDIR /app
COPY . .
RUN go get
RUN go build
CMD ["config-store"]

View File

@ -2,10 +2,13 @@ module git.brag.pro/b68/config-store
go 1.19
require (
github.com/gofiber/fiber/v2 v2.41.0
github.com/joho/godotenv v1.4.0
)
require (
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/gofiber/fiber/v2 v2.41.0 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect

18
packages/config-store/setup.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
ENV_PATH=packages/config-store/.env
# Prompt user for input
read -p "Enter username: " username
read -p "Enter password: " password
read -p "Enter port: " port
rm -rf $ENV_PATH
# Save the input to a file
echo "BASIC_USERNAME=$username" >> $ENV_PATH
echo "BASIC_PASSWORD=$password" >> $ENV_PATH
echo "PORT=$port" >> $ENV_PATH
# Echo a message to confirm the file has been saved
echo "Configuration saved to packages/config-store/.env"

1
packages/dash/setup.sh Executable file
View File

@ -0,0 +1 @@
echo "Hello from Dash"

0
packages/wh/.setup Normal file
View File

1
packages/wh/setup.sh Executable file
View File

@ -0,0 +1 @@
echo "Hello from WH"

45
scripts/setup.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Set packages folder path
PACKAGES_FOLDER=packages
bold=$(tput bold)
normal=$(tput sgr0)
# Welcome message
echo "${bold}Welcome to the setup script!${normal}"
echo ""
echo "This script will setup .env all the packages in the $PACKAGES_FOLDER folder."
echo ""
# Iterate through all packages
for package in $PACKAGES_FOLDER/*; do
# Check if package is a directory
echo "${bold} Setting up $package ${normal}"
if [ -d "$package" ]; then
# Check if .setup file is present. If not, skip package
if [ ! -f "$package/.setup" ]; then
echo "Skipping $package"
echo ""
continue
fi
# Check if .env file presen. If present, ask user if he wants to overwrite it
if [ -f "$package/.env" ]; then
read -p "Overwrite $package/.env? [y/N] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo ""
continue
fi
fi
chmod +x "$package/setup.sh"
bash "$package/setup.sh"
echo ""
fi
done