config.go
config.go - Overview
-
Overview This file defines the configuration structure and related functions for the web package, including default values and validation.
-
Detailed Documentation
Config
- Purpose: Holds the configuration parameters for the web component.
- Fields:
Enabled
(bool): Whether the web package is enabled.Prefix
(string): The prefix to serve the files from.Directory
(string): The directory containing the static build files. The root of this directory should have an index.html file.
NewConfigFactory
- Purpose: Creates a new ConfigFactory for the web package.
- Returns:
factory.ConfigFactory
: A new ConfigFactory instance.
newConfig
- Purpose: Creates a new Config instance with default values.
- Returns:
factory.Config
: A new Config instance with default values (Enabled: true, Prefix: "/", Directory: "/etc/signoz/web").
(*Config) Validate
- Purpose: Validates the Config instance. Currently, it always returns nil, indicating no validation errors.
- Parameters:
c
(Config): The Config instance to validate.
- Returns:
error
: Always returns nil.
(*Config) Provider
- Purpose: Returns a string indicating the provider type based on whether the web package is enabled.
- Parameters:
c
(Config): The Config instance.
- Returns:
string
: "router" if the web package is enabled; otherwise, "noop".
Include in Getting Started: NO