mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 00:33:03 +08:00
🧹 remove panic
This commit is contained in:
@@ -3,10 +3,11 @@ package arangodb
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/arangodb/go-driver"
|
"github.com/arangodb/go-driver"
|
||||||
"github.com/arangodb/go-driver/http"
|
"github.com/arangodb/go-driver/http"
|
||||||
"github.com/gofiber/utils"
|
"github.com/gofiber/utils"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Storage interface that is implemented by storage providers
|
// Storage interface that is implemented by storage providers
|
||||||
|
@@ -64,15 +64,12 @@ func (c Config) hostComposed() string {
|
|||||||
|
|
||||||
// Helper function to set default values
|
// Helper function to set default values
|
||||||
func configDefault(cfg Config) Config {
|
func configDefault(cfg Config) Config {
|
||||||
if cfg.Username == "" || cfg.Password == "" {
|
|
||||||
panic("username and password are mandatory")
|
|
||||||
}
|
|
||||||
// Set default values
|
// Set default values
|
||||||
if cfg.Host == "" {
|
if cfg.Host == "" {
|
||||||
cfg.Host = ConfigDefault.Host
|
cfg.Host = ConfigDefault.Host
|
||||||
} else {
|
} else {
|
||||||
if !strings.HasPrefix(cfg.Host, "http") {
|
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 {
|
if cfg.Port <= 0 {
|
||||||
|
Reference in New Issue
Block a user