app

package
v0.0.0-...-ae683e3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 22 Imported by: 0

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:

  1. Determines whether health check should be enabled based on the environment.
  2. Retrieves configuration values from the Vault if health check is enabled.
  3. Initializes the Elasticsearch service based on the TLS setting.
  4. 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.
  5. Creates a new Elasticsearch client using the configuration.
  6. Performs a health check on the Elasticsearch client if health check is enabled.
  7. Retrieves the index name from the environment variables or uses the default index name.
  8. 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.

Jump to

Keyboard shortcuts

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