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

edb-connect: fix edb default host and allow caller to set it #2214

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tools/edbconnect/edb-connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
14 changes: 12 additions & 2 deletions tools/edbconnect/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <edb-host>")
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 {
Expand All @@ -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.")
Expand Down
Loading