config

package
v0.0.0-...-f308040 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config implements functions for saving a struct to a file It then provides functions to later read it such that we can restore the same struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// V2 indicates we are version 2
	V2 *v2.V2
	// contains filtered or unexported fields
}

Config represents the config state file

func NewFromDirectory

func NewFromDirectory(dir string) *Config

NewFromDirectory creates a new config struct from a directory It does this by loading the JSON file from disk

func (*Config) Discovery

func (c *Config) Discovery() *discovery.Discovery

Discovery gets the discovery list from the state file

func (*Config) HasSecureInternet

func (c *Config) HasSecureInternet() bool

HasSecureInternet returns whether or not the configuration has a secure internet server

func (*Config) Load

func (c *Config) Load() error

Load loads the state file from disk

func (*Config) Save

func (c *Config) Save() error

Save saves the state file to disk

type Versioned

type Versioned struct {
	// V1 is the version 1 state file that is no longer used but converted from
	V1 *v1.V1 `json:"v1,omitempty"`
	// V2 is the version 2 state file
	V2 *v2.V2 `json:"v2,omitempty"`
}

Versioned is the final top-level state file that is written to disk

Directories

Path Synopsis
Package atomicfile contains code related to writing to filesystems atomically.
Package atomicfile contains code related to writing to filesystems atomically.
Package v1 implements a minimum set of the v1 config to convert it to a v2 config In version 1 of the config we used the internal state as the config This was bad as now if we want to change some internal representation the config also changes This package can be removed when most people have migrated from v1 to v2
Package v1 implements a minimum set of the v1 config to convert it to a v2 config In version 1 of the config we used the internal state as the config This was bad as now if we want to change some internal representation the config also changes This package can be removed when most people have migrated from v1 to v2
Package v2 implements version 2 of the state file
Package v2 implements version 2 of the state file

Jump to

Keyboard shortcuts

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