Added app.conf file

This commit is contained in:
2025-03-11 22:01:23 +03:00
parent c89e3bdada
commit c909d5b20a
3 changed files with 55 additions and 9 deletions

View File

@@ -1,7 +1,27 @@
#!/bin/bash
APP_DIR="$HOME/.db-middleware"
CODE_DIR="$HOME/.db-middleware/code"
CODE_DIR="$APP_DIR/code"
CONFIG_DIR="$APP_DIR/config"
CONFIG_FILE="$CONFIG_DIR/app.conf"
# Function to load the config file
load_config() {
if [[ -f "$CONFIG_FILE" ]]; then
source "$CONFIG_FILE"
else
echo "Config file not found: $CONFIG_FILE"
exit 1
fi
}
show_config() {
echo "Current Config:"
echo "CONTAINER_NAME: $CONTAINER_NAME"
echo "APP_PORT: $APP_PORT"
echo "DBS_PORTS: $DBS_PORTS"
}
install() {
echo
@@ -12,13 +32,17 @@ install() {
cd "$CODE_DIR"
docker build -t db-middleware .
# docker build -t db-middleware .
echo
echo "+----------------------------------------+"
echo "| Installed the Middleware Successfully. |"
echo "| Installed the Middleware Successfully! |"
echo "+----------------------------------------+"
echo
echo "- You can run the middleware simply using the manager:"
echo " >>> db-middleware start"
echo "- Or directly by running the docker container:"
echo " >>> docker run db-middleware -p <port>:<port> -v /path/to/app/directory/"
}
# Function for the "upgrade" command
@@ -30,13 +54,17 @@ upgrade() {
# Function for the "status" command
status() {
echo "Running the 'status' function."
docker
# Add your status-checking logic here
}
# Function for the "start" command
start() {
echo "Running the 'start' function."
# Add your start logic here
echo "+---------------------------+"
echo "| Starting the Container... |"
echo "+---------------------------+"
echo
docker run db-middleware
}
# Function for the "stop" command
@@ -64,15 +92,23 @@ main() {
install
;;
upgrade)
load_config
upgrade
;;
status)
load_config
status
;;
start)
load_config
start
;;
show_config)
load_config
show_config
;;
stop)
load_config
stop
;;
*)
@@ -83,4 +119,5 @@ main() {
}
# Run the script with the provided arguments
main "$@"