settings

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 11

Documentation

Index

Constants

View Source
const CONFIG_JSON_PATH = ".kpm/config/config.json"

The config.json used to persist user information

View Source
const DEFAULT_OCI_PLAIN_HTTP = OFF
View Source
const DEFAULT_OCI_PLAIN_HTTP_ENV = "OCI_REG_PLAIN_HTTP"
View Source
const DEFAULT_REGISTRY = "ghcr.io"
View Source
const DEFAULT_REGISTRY_ENV = "KPM_REG"
View Source
const DEFAULT_REPO = "kcl-lang"
View Source
const DEFAULT_REPO_ENV = "KPM_REPO"
View Source
const KPM_JSON_PATH = ".kpm/config/kpm.json"

The kpm.json used to describe the default configuration of kpm.

View Source
const OFF = "off"
View Source
const ON = "on"
View Source
const PACKAGE_CACHE_PATH = ".kpm/config/package-cache"

The package-cache path, kpm will try lock 'package-cache' before downloading a package.

Variables

This section is empty.

Functions

func GetFullPath

func GetFullPath(jsonFileName string) (string, error)

GetFullPath returns the full path file path under '$HOME/.kpm/config/'

Types

type KpmConf

type KpmConf struct {
	DefaultOciRegistry  string
	DefaultOciRepo      string
	DefaultOciPlainHttp bool
}

The kpm configuration

func DefaultKpmConf

func DefaultKpmConf() KpmConf

DefaultKpmConf create a default configuration for kpm.

type Settings

type Settings struct {
	CredentialsFile string
	KpmConfFile     string
	// the default configuration for kpm.
	Conf KpmConf

	// the flock used to lock the 'package-cache' file.
	PackageCacheLock *flock.Flock

	// the error catch from the closure in once.Do()
	ErrorEvent *reporter.KpmEvent
}

func GetSettings

func GetSettings() *Settings

GetSettings will return the kpm setting singleton.

func (*Settings) AcquirePackageCacheLock

func (settings *Settings) AcquirePackageCacheLock(logWriter io.Writer) error

AcquirePackageCacheLock will try to lock the 'package-cache' file.

func (*Settings) DefaultOciPlainHttp added in v0.3.3

func (settings *Settings) DefaultOciPlainHttp() bool

DefaultOciPlainHttp return the default OCI plain http 'false'.

func (*Settings) DefaultOciRef added in v0.3.2

func (settings *Settings) DefaultOciRef() string

DefaultOciRef return the default OCI ref 'ghcr.io/kcl-lang'.

func (*Settings) DefaultOciRegistry

func (settings *Settings) DefaultOciRegistry() string

DefaultOciRepo return the default OCI registry 'ghcr.io'.

func (*Settings) DefaultOciRepo

func (settings *Settings) DefaultOciRepo() string

DefaultOciRepo return the default OCI repo 'kcl-lang'.

func (*Settings) LoadSettingsFromEnv added in v0.3.2

func (settings *Settings) LoadSettingsFromEnv() (*Settings, *reporter.KpmEvent)

LoadSettingsFromEnv will load the kpm settings from environment variables.

func (*Settings) ReleasePackageCacheLock

func (settings *Settings) ReleasePackageCacheLock() error

ReleasePackageCacheLock will try to unlock the 'package-cache' file.

Jump to

Keyboard shortcuts

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