Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitRoutes ¶
func InitRoutes(alexandrosHandler *AlexandrosHandler) *mux.Router
InitRoutes to start up a mux router and return the routes
Types ¶
type AlexandrosHandler ¶
type AlexandrosHandler struct { Elastic aristoteles.Client Index string Tracer *aristophanes.ClientTracer }
func CreateNewConfig ¶
func CreateNewConfig(env string) (*AlexandrosHandler, error)
CreateNewConfig creates a new configuration based on the provided environment.
The function performs the following steps:
- Determines whether health check should be enabled based on the environment.
- Retrieves configuration values from the Vault if health check is enabled.
- Initializes the Elasticsearch service based on the TLS setting.
- Creates the configuration object with the Elasticsearch service, username, password, and certificate. - If health check is disabled, the configuration is created using the environment, testOverWrite, and TLS settings. - If health check is enabled, the configuration is created using the retrieved Vault configuration values.
- Creates a new Elasticsearch client using the configuration.
- Performs a health check on the Elasticsearch client if health check is enabled.
- Retrieves the index name from the environment variables or uses the default index name.
- Returns the created configuration with the Elasticsearch client and index name.
Parameters:
- env: The environment name (e.g., "LOCAL", "TEST").
Returns:
- *Config: The created configuration containing the Elasticsearch client and index name.
- error: An error if any occurred during the configuration creation process.
Click to show internal directories.
Click to hide internal directories.