Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
raz-amir committed Jul 30, 2023
1 parent b053e10 commit d708fee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (c *Config) ToFakeGcsOptions(scheme string) fakestorage.Options {
}
}
port := c.Port
if c.Scheme == "both" && scheme == "http" {
if scheme == "http" {
port = c.PortHTTP
}
logger := logrus.New()
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ func startServer(logger *logrus.Logger, cfg *config.Config) {
opts *fakestorage.Options
}

listenersAndOpts := make([]listenerAndOpts, 2)
var listenersAndOpts []listenerAndOpts

if cfg.Scheme != "both" {
listenersAndOpts = make([]listenerAndOpts, 1)
listener, opts := createListener(logger, cfg, cfg.Scheme)
listenersAndOpts[0] = listenerAndOpts{listener, opts}
} else {
listenersAndOpts = make([]listenerAndOpts, 2)
listener, opts := createListener(logger, cfg, "http")
listenersAndOpts[0] = listenerAndOpts{listener, opts}
listener, opts = createListener(logger, cfg, "https")
Expand All @@ -74,7 +76,7 @@ func startServer(logger *logrus.Logger, cfg *config.Config) {

addMimeTypes()

httpServer, err := fakestorage.NewServerWithOptions(*listenersAndOpts[1].opts)
httpServer, err := fakestorage.NewServerWithOptions(*listenersAndOpts[0].opts)
if err != nil {
logger.WithError(err).Fatal("couldn't start the server")
}
Expand Down

0 comments on commit d708fee

Please sign in to comment.