summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/backend/api.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index dc7cbbf..8f36f1f 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -5,7 +5,9 @@ package backend
import (
"C"
"encoding/json"
+ "fmt"
"log"
+ "os"
"strconv"
"strings"
"unsafe"
@@ -150,10 +152,20 @@ func InitOptsFromJSON(provider, providersJSON string) *InitOpts {
if err != nil {
log.Println("ERROR while parsing json:", err)
}
+ var providerOpts *bitmask.ProviderOpts
+ providerOpts = &providers.Data[0]
if len(providers.Data) != 1 {
- panic("BUG: we do not support multi-provider yet")
+ chosenProvider := os.Getenv("LEAP_PROVIDER")
+ if chosenProvider != "" {
+ for _, p := range providers.Data {
+ if p.Provider == chosenProvider {
+ log.Println("Selecting provider: " + chosenProvider)
+ return &InitOpts{ProviderOptions: &p}
+ }
+ }
+ panic("BUG: unknown provider")
+ }
}
- providerOpts := &providers.Data[0]
return &InitOpts{ProviderOptions: providerOpts}
}