You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: options.go
    path of file: ./repos/buffalo
    
    the code of the file until where you have to start completion: package buffalo

import (
	"context"
	"fmt"
	"net/http"
	"strings"

	"github.com/gobuffalo/buffalo/internal/defaults"
	"github.com/gobuffalo/buffalo/worker"
	"github.com/gobuffalo/envy"
	"github.com/gobuffalo/logger"
	"github.com/gorilla/s
    
func optionsWithDefaults(opts Options) Options {
	opts.Env = defaults.String(opts.Env, envy.Get("GO_ENV", "development"))
	opts.Name = defaults.String(opts.Name, "/")
	addr := "0.0.0.0"
	if opts.Env == "development" {
		addr = "127.0.0.1"
	}
	envAddr := envy.Get("ADDR", addr)

	if strings.HasPrefix(envAddr, "unix:") {
		// UNIX domain socket doesn't have a port
		opts.Addr = envAddr
	} else {
		// TCP case
		opts.Addr = defaults.String(opts.Addr, fmt.Sprintf("%s:%s", envAddr, envy.Get("PORT", "3000")))
	}
	opts.Host = defaults.String(opts.Host, envy.Get("HOST", fmt.Sprintf("http://127.0.0.1:%s", envy.Get("PORT", "3000"))))

	if opts.PreWares == nil {
		opts.PreWares = []PreWare{}
	}
	if opts.PreHandlers == nil {
		opts.PreHandlers = []http.Handler{}
	}

	if opts.Context == nil {
		opts.Context = context.Background()
	}
	opts.Context, opts.cancel = context.WithCancel(opts.Context)

	if opts.Logger == nil {
		if lvl, err := envy.MustGet("LOG_LEVEL"); err == nil {
			opts.LogLvl, err = logger.ParseLevel(lvl)
			if err != nil {
				opts.LogLvl = logger.DebugLevel
			}
		}

		if opts.LogLvl == 0 {
			opts.LogLvl = logger.DebugLevel
		}

		opts.Logger = logger.New(opts.LogLvl)
	}

	if opts.SessionStore == nil {
		secret := envy.Get("SESSION_SECRET", "")

		if secret == "" && (opts.Env == "development" || opts.Env == "test") {
			secret = "buffalo-secret"
		}

		// In production a SESSION_SECRET must be set!
		if secret == "" {
			opts.Logger.Warn("Unless you set SESSION_SECRET env variable, your session storage is not protected!")
		}

		cookieStore := sessions.NewCookieStore([]byte(secret))

		//Cookie secure attributes, see: https://www.owasp.org/index.php/Testing_for_cookies_attributes_(OTG-SESS-002)
		cookieStore.Options.HttpOnly = true
		if opts.Env == "production" {
			cookieStore.Options.Secure = true
		}

		opts.SessionStore = cookieStore
	}
	opts.SessionName = defaults.String(opts.SessionName, "_buffalo_session")

	if opts.Worker == nil {
		w := worker.NewSimpleWithContext(opts.Context)
		w.Logger = opts.Logger
		opts.Worker = w
	}

	opts.TimeoutSecondShutdown = defaults.Int(opts.TimeoutSecondShutdown, 60)

	return opts
}