internal

package
v0.371.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package internal manages the persistent profile configuration of the FTL CLI.

Layout will be something like:

.ftl-project/
	project.json
	profiles/
		<profile>/
			profile.json
			[secrets.json]
			[config.json]

See the design document for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(project Project) error

Types

type Profile

type Profile struct {
	Name            string                    `json:"name"`
	Endpoint        string                    `json:"endpoint"`
	Type            ProfileType               `json:"type"`
	SecretsProvider configuration.ProviderKey `json:"secrets-provider"`
	ConfigProvider  configuration.ProviderKey `json:"config-provider"`
}

func (*Profile) EndpointURL

func (p *Profile) EndpointURL() (*url.URL, error)

type ProfileType

type ProfileType string
const (
	ProfileTypeLocal  ProfileType = "local"
	ProfileTypeRemote ProfileType = "remote"
)

type Project

type Project struct {
	Realm          string   `json:"realm"`
	FTLMinVersion  string   `json:"ftl-min-version,omitempty"`
	ModuleRoots    []string `json:"module-roots,omitempty"`
	NoGit          bool     `json:"no-git,omitempty"`
	DefaultProfile string   `json:"default-profile,omitempty"`

	Root string `json:"-"`
}

func Load

func Load(root string) (Project, error)

Load the project configuration from the given root directory.

func (Project) LoadProfile

func (p Project) LoadProfile(name string) (Profile, error)

func (*Project) LocalConfigPath

func (p *Project) LocalConfigPath(profile string) string

LocalConfigPath returns the path to the config file for the given local profile.

func (*Project) LocalSecretsPath

func (p *Project) LocalSecretsPath(profile string) string

LocalSecretsPath returns the path to the secrets file for the given local profile.

func (Project) Profiles

func (p Project) Profiles() ([]string, error)

Profiles returns the names of all profiles in the project.

func (*Project) Save

func (p *Project) Save() error

func (Project) SaveProfile

func (p Project) SaveProfile(profile Profile) error

SaveProfile saves a profile to the project.

Jump to

Keyboard shortcuts

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