Skip to content

⚙️ DefaultOptions ​

Returns the default configuration options for a Composer instance, the most common starting point for creating an instance.

When to use ​

Use when you don't want to fill in each configuration field manually but want a set of sensible defaults. The default configuration covers the vast majority of common scenarios and can be passed directly to New.

Signature ​

go
func DefaultOptions() Options

Parameters ​

This method takes no parameters.

Return value ​

Return valueTypeDescription
Sole return valueOptionsOptions struct containing the default configuration

Defaults: WorkingDir is empty (i.e. the current directory), AutoInstall is true, DefaultTimeout is 10 * time.Minute.

Example ​

go
package main

import (
	"fmt"
	"log"

	"github.com/scagogogo/composer-skills/pkg/composer"
)

func main() {
	options := composer.DefaultOptions()
	comp, err := composer.New(options)
	if err != nil {
		log.Fatalf("init failed: %v", err)
	}
	fmt.Println("Composer initialized ✅")
}

Advanced ​

  • Override fields on top of the defaults as needed, e.g. options.WorkingDir = "/srv/app".
  • To disable auto-install, set options.AutoInstall = false.
  • For a one-step setup, use QuickSetup, which is built on top of the default options.

Released under the MIT License