Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove interactive components of Mojafos #15

Open
tdaly61 opened this issue Apr 10, 2024 · 2 comments
Open

remove interactive components of Mojafos #15

tdaly61 opened this issue Apr 10, 2024 · 2 comments

Comments

@tdaly61
Copy link
Collaborator

tdaly61 commented Apr 10, 2024

I think we need to eliminate the user interaction and Mojafos behaviour should be driven from the initial parameters

  • if you want to deploy or destroy vNext and 2 Mifos and PHEE we need to be able to do something like run.sh -m install -s ml_mf2_ph with the -s string determining the services and the counts to be made (see below for an outline). This is important as it means we can out this into CI/CD (circleCi) and do full system testing using Mojafos for vNext,Mifos and PHEE (which will be especially cool once we start running txns end-to end)
  • example parameter handling code
#!/bin/bash
# Default values
mode=""
ml=true
mf=true
ph=true
mf_count=1
# Usage function
usage() {
  echo "Usage: $0 -m [install|delete] [-s <string>] [-c <count>]"
  echo "Options:"
  echo "  -m: Mode (install or delete)"
  echo "  -s: Services to operate on (ml, mf, ph)"
  echo "  -c: Count for mf service (default: 1)"
  exit 1
}
# Parse options
while getopts ":m:s:c:" opt; do
  case $opt in
    m)
      mode=$OPTARG
      ;;
    s)
      ml=false
      mf=false
      ph=false
      services=($(echo $OPTARG | tr ',' ' '))
      for service in "${services[@]}"; do
        case $service in
          ml)
            ml=true
            ;;
          mf)
            mf=true
            ;;
          ph)
            ph=true
            ;;
          *)
            echo "Invalid service: $service"
            usage
            ;;
        esac
      done
      ;;
    c)
      mf_count=$OPTARG
      ;;
    \?)
      echo "Invalid option: -$OPTARG" >&2
      usage
      ;;
    :)
      echo "Option -$OPTARG requires an argument." >&2
      usage
      ;;
  esac
done
# Check if mode is provided
if [ -z "$mode" ]; then
  echo "Mode is required."
  usage
fi
# Perform actions based on mode
if [ "$mode" = "install" ]; then
  echo "Installing selected services:"
  $ml && echo "- Installing ml"
  $mf && echo "- Installing $mf_count mf"
  $ph && echo "- Installing ph"
elif [ "$mode" = "delete" ]; then
  echo "Deleting selected services:"
  $ml && echo "- Deleting ml"
  $mf && echo "- Deleting $mf_count mf"
  $ph && echo "- Deleting ph"
else
  echo "Invalid mode. Mode should be 'install' or 'delete'."
  usage
fi (edited) 
@elijah0kello
Copy link
Collaborator

Interactivity has also been removed from the scripts. Alll configuration is from command line args

@tdaly61
Copy link
Collaborator Author

tdaly61 commented May 15, 2024

Yay ! This is great @elijah0kello , I will look for / at the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants