projectconfig

package
v0.402.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

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

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

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

type Config

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

	Name                  string                      `toml:"name,omitempty"`
	Global                ConfigAndSecrets            `toml:"global,omitempty"`
	SecretsProvider       configuration.ProviderKey   `toml:"secrets-provider,omitempty"`
	ConfigProvider        configuration.ProviderKey   `toml:"config-provider,omitempty"`
	Modules               map[string]ConfigAndSecrets `toml:"modules,omitempty"`
	ModuleDirs            []string                    `toml:"module-dirs,omitempty"`
	Commands              Commands                    `toml:"commands,omitempty"`
	FTLMinVersion         string                      `toml:"ftl-min-version,omitempty"`
	Hermit                bool                        `toml:"hermit,omitempty"`
	NoGit                 bool                        `toml:"no-git,omitempty"`
	DisableIDEIntegration bool                        `toml:"disable-ide-integration,omitempty"`
}

func Load

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

Load project config from a file.

func (Config) AbsModuleDirs

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

func (c Config) Root() string

Root directory of the project.

func (Config) SchemaPath added in v0.387.1

func (c Config) SchemaPath(module string) string

SchemaPath returns the path to the schema file for the given module.

func (*Config) Validate

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