🧹 remove panic

This commit is contained in:
Fenny
2020-11-27 15:06:27 +01:00
parent a24dd2827c
commit 9b7d6b130f
2 changed files with 3 additions and 5 deletions

View File

@@ -3,10 +3,11 @@ package arangodb
import (
"context"
"fmt"
"time"
"github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/http"
"github.com/gofiber/utils"
"time"
)
// Storage interface that is implemented by storage providers

View File

@@ -64,15 +64,12 @@ func (c Config) hostComposed() string {
// Helper function to set default values
func configDefault(cfg Config) Config {
if cfg.Username == "" || cfg.Password == "" {
panic("username and password are mandatory")
}
// Set default values
if cfg.Host == "" {
cfg.Host = ConfigDefault.Host
} else {
if !strings.HasPrefix(cfg.Host, "http") {
panic("the host should start with http:// or https://")
panic("Host should start with `http://` or `https://`")
}
}
if cfg.Port <= 0 {