projectconfig

package
v0.328.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create added in v0.260.0

func Create(ctx context.Context, config Config, dir string) error

Create creates the ftl-project.toml file with the given Config into dir.

func DefaultConfigPath added in v0.242.0

func DefaultConfigPath() optional.Option[string]

DefaultConfigPath returns the absolute default path for the project config file, if possible.

The default path is determined by the FTL_CONFIG environment variable, if set, or by the presence of a Git repository. If the Git repository is found, the default path is the root of the repository with the filename "ftl-project.toml".

func Save

func Save(config Config) error

Save project config to its file atomically.

Types

type Commands added in v0.163.11

type Commands struct {
	Startup []string `toml:"startup"`
}

type Config

type Config struct {
	// Path to the config file.
	Path string `toml:"-"`

	Name          string                      `toml:"name"`
	Global        ConfigAndSecrets            `toml:"global"`
	Modules       map[string]ConfigAndSecrets `toml:"modules"`
	ModuleDirs    []string                    `toml:"module-dirs"`
	Commands      Commands                    `toml:"commands"`
	FTLMinVersion string                      `toml:"ftl-min-version"`
	Hermit        bool                        `toml:"hermit"`
	NoGit         bool                        `toml:"no-git"`
}

func Load

func Load(ctx context.Context, path string) (Config, error)

Load project config from a file.

func (Config) AbsModuleDirs added in v0.255.0

func (c Config) AbsModuleDirs() []string

AbsModuleDirs returns the absolute path for the module-dirs field from the ftl-project.toml, unless that is not defined, in which case it defaults to the root directory.

func (Config) Root added in v0.255.2

func (c Config) Root() string

Root directory of the project.

func (Config) Validate added in v0.276.6

func (c Config) Validate() error

Validate checks that the configuration is valid.

type ConfigAndSecrets

type ConfigAndSecrets struct {
	Config  map[string]*URL `toml:"configuration"`
	Secrets map[string]*URL `toml:"secrets"`
}

type URL

type URL url.URL

A URL that supports marshalling and unmarshalling which is, very frustratingly, not possible with the stdlib url.URL.

func MustParseURL

func MustParseURL(rawurl string) *URL

func ParseURL

func ParseURL(rawurl string) (*URL, error)

func (URL) GoString

func (u URL) GoString() string

func (URL) MarshalText

func (u URL) MarshalText() ([]byte, error)

func (*URL) UnmarshalText

func (u *URL) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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