setup

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetupCmd = &cobra.Command{
	Use:   "setup",
	Short: fmt.Sprintf("Setup and configure the %s.", name),
	RunE: func(cmd *cobra.Command, args []string) error {
		fmt.Printf("Starting %s setup...\n", name)

		var isOverwrite bool
		configExists := fileExists(configTarget)

		if configExists {
			fmt.Println("A configuration file already exists at:", configTarget)
			fmt.Println("When setting up non-interactively, the existing configuration file will be used.")

			if !term.IsTerminal(syscall.Stdin) {
				return nil
			}

			isOverwrite = cli.PromptForBool("Do you want to overwrite it with a new configuration?: ")
			if !isOverwrite {
				fmt.Println("Keeping the existing configuration file. Skipping configuration update.")
				return nil
			}
		}

		fmt.Println("Applying a new configuration automatically...")

		output, err := exec.Command("systemd-tmpfiles", "--create").CombinedOutput()
		if err != nil {
			return fmt.Errorf("%w\n%s", err, string(output))
		}

		err = writeConfig()
		if err != nil {
			return err
		}

		fmt.Println("Configuration file successfully updated.")
		return nil
	},
}

Functions

func SetConfigPaths

func SetConfigPaths(serviceName string)

Types

type ConfigData

type ConfigData struct {
	URL    string
	ID     string
	Key    string
	Verify string
	CACert string
	Debug  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL