diff --git a/tools/edbconnect/edb-connect.sh b/tools/edbconnect/edb-connect.sh index 37d14c740a..36b0ea2575 100644 --- a/tools/edbconnect/edb-connect.sh +++ b/tools/edbconnect/edb-connect.sh @@ -5,11 +5,12 @@ IMAGE_NAME="testnetobscuronet.azurecr.io/obscuronet/edbconnect:latest" CONTAINER_BASE_NAME="edb-connect" UNIQUE_ID=$(date +%s%3N) # Using milliseconds for uniqueness CONTAINER_NAME="${CONTAINER_BASE_NAME}-${UNIQUE_ID}" -VOLUME_NAME="obscuronode-enclave-volume" +VOLUME_NAME="obscuronode-enclave-volume-0" +DB_HOST="obscuronode-edgelessdb-0" NETWORK_NAME="node_network" SGX_ENCLAVE_DEVICE="/dev/sgx_enclave" SGX_PROVISION_DEVICE="/dev/sgx_provision" -COMMAND="ego run /home/ten/go-ten/tools/edbconnect/main/main" +COMMAND="ego run /home/ten/go-ten/tools/edbconnect/main/main $DB_HOST" # Function to destroy exited containers matching the base name destroy_exited_containers() { diff --git a/tools/edbconnect/main/main.go b/tools/edbconnect/main/main.go index 42b2c265b8..28f1513a1b 100644 --- a/tools/edbconnect/main/main.go +++ b/tools/edbconnect/main/main.go @@ -12,6 +12,16 @@ import ( ) func main() { + // get edbHost from first command line arg + var edbHost string + if len(os.Args) > 1 { + edbHost = os.Args[1] + } else { + fmt.Println("Usage: edbconnect ") + fmt.Println("Ensure you have the latest copy of the ./edb-connect.sh launch script if you see this error.") + os.Exit(1) + } + fmt.Println("Retrieving Edgeless DB credentials...") creds, found, err := edgelessdb.LoadCredentialsFromFile() if err != nil { @@ -29,9 +39,9 @@ func main() { } fmt.Println("TLS config created. Connecting to Edgeless DB...") testlog.SetupSysOut() - db, err := edgelessdb.ConnectToEdgelessDB("obscuronode-edgelessdb", cfg, testlog.Logger()) + db, err := edgelessdb.ConnectToEdgelessDB(edbHost, cfg, testlog.Logger()) if err != nil { - fmt.Println("Error connecting to Edgeless DB:", err) + fmt.Printf("Error connecting to Edgeless DB at %s: %v\n", edbHost, err) panic(err) } fmt.Println("Connected to Edgeless DB.")