Documentation ¶
Index ¶
- Constants
- type Config
- type Dependency
- type HasConfig
- type HasDefaultConfig
- type Manager
- type Object
- func (n Object) Get(key string) interface{}
- func (n Object) GetBool(key string) bool
- func (n Object) GetDuration(key string) time.Duration
- func (n Object) GetFloat(key string) float64
- func (n Object) GetInt(key string) int
- func (n Object) GetJson(key string) []byte
- func (n Object) GetString(key string) string
- func (n Object) GetStrings(key string) []string
- func (n Object) IsSet(key string) bool
- func (n Object) Keys() (keys []string)
- func (n Object) Marshal() ([]byte, error)
- func (n Object) Set(key string, value interface{})
- func (n Object) SetDefault(key string, defaultValue interface{})
- func (n Object) Unmarshal(data []byte) error
- type Service
- func (s *Service) ConfigDirectory() string
- func (s *Service) Configs() map[string]*Config
- func (s *Service) CreateConfigWithFileName(path string) (*Config, error)
- func (s *Service) DependenciesResolved() bool
- func (s *Service) GetConfigByFileName(path string) (*Config, error)
- func (s *Service) GetFilePath(name string) string
- func (s *Service) Init(mesh servicemesh.Mesh)
- func (s *Service) LoadConfigWithFileName(path string) (*Config, error)
- func (s *Service) Logger() *slog.Logger
- func (s *Service) ModalTui() (name string, model tea.Model)
- func (s *Service) Name() string
- func (s *Service) OnServiceAdded(service servicemesh.Service)
- func (s *Service) Ready() bool
- func (s *Service) ResolveDependencies(services []servicemesh.Service)
- func (s *Service) SaveConfigWithFileName(path string) error
- func (s *Service) SetConfigDirectory(dir string) error
- func (s *Service) SetLogger(l *slog.Logger)
Constants ¶
const (
EventConfigChanged = "config file changed"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) RootDirectory ¶
type Dependency ¶
type Dependency = Manager
type HasConfig ¶
type HasConfig interface {
ConfigFileName() string // ConfigFilePath returns the path to the configuration file.
}
HasConfig represents a something with a configuration file path and retrieval methods.
type HasDefaultConfig ¶
type HasDefaultConfig interface { HasConfig LoadConfig(*Config) // the config, or default config, after it's been loaded DefaultConfig() (cfg Config) // DefaultConfig returns the default configuration. }
HasDefaultConfig represents something with a default configuration.
type Manager ¶
type Manager interface { servicemesh.Service GetFilePath(path string) string ConfigDirectory() string // ConfigDirectory returns the directory path where configurations are stored. SetConfigDirectory(string) error // SetConfigDirectory sets the directory path for configurations. Configs() map[string]*Config // Configs returns all configurations stored in the service. GetConfigByFileName(name string) (*Config, error) // GetConfig retrieves a configuration by its path. CreateConfigWithFileName(name string) (*Config, error) // CreateConfig creates a new configuration file at the specified path. LoadConfigWithFileName(name string) (*Config, error) // LoadConfig loads a configuration from the specified path. SaveConfigWithFileName(name string) error // SaveConfig saves a configuration to the specified path. }
Manager represents something that manages configurations.
type Object ¶
type Object map[string]interface{}
func (Object) GetStrings ¶
func (Object) SetDefault ¶
type Service ¶
type Service struct { RootDirectory string // contains filtered or unexported fields }
Service is a config file manager that marshals to and from json files.
func (*Service) ConfigDirectory ¶
ConfigDirectory returns the directory path where the service's configurations are stored. If the directory is not set, it returns a default.
func (*Service) CreateConfigWithFileName ¶
CreateConfigWithFileName creates a new configuration file at the specified path. It locks the service's mutex to ensure safe concurrent access.
func (*Service) DependenciesResolved ¶
func (*Service) GetConfigByFileName ¶
GetConfigByFileName retrieves a configuration by its path from the service's internal map. It locks the service's mutex to ensure safe concurrent access.
func (*Service) GetFilePath ¶
GetFilePath returns the absolute path for a given incoming file
func (*Service) Init ¶
func (s *Service) Init(mesh servicemesh.Mesh)
Init satisfies the runtime.IsRuntimeService interface
func (*Service) LoadConfigWithFileName ¶
LoadConfigWithFileName loads a configuration from the specified path. It locks the service's mutex to ensure safe concurrent access.
func (*Service) OnServiceAdded ¶
func (s *Service) OnServiceAdded(service servicemesh.Service)
func (*Service) ResolveDependencies ¶
func (s *Service) ResolveDependencies(services []servicemesh.Service)
func (*Service) SaveConfigWithFileName ¶
SaveConfigWithFileName saves a configuration to the specified path. It locks the service's mutex to ensure safe concurrent access.
func (*Service) SetConfigDirectory ¶
SetConfigDirectory sets the directory path where the service's configurations should be stored. It locks the service's mutex to ensure safe concurrent access.