# README
OpenSearch Config
Pulls environment variables to configure the opensearch-go library
Usage
package main
import (
"context"
"github.com/shopsmart/opensearchconfig"
)
func main() {
ctx := context.Background()
client, err := opensearchconfig.NewClientFromEnv(ctx)
if err != nil {
panic(err) // Beware the scary panic
}
// Do stuff with the client
}
Configuring
Available environment variables
OPENSEARCH_URL
is parsed by the opensearch-go library and configures the various addresses to be used with the client. Separate endpoints with a comma.OPENSEARCH_SKIP_SSL
set to true will enable skipping the SSL checkOPENSEARCH_AUTH
sets what type of auth to use for connecting to the OpenSearch cluster. By default, it will usenone
auth. Options are:none
,basic
,iam
.OPENSEARCH_USERNAME
represents the username for the user to login with only if auth is set tobasic
OPENSEARCH_PASSWORD
represents the password for the user to login with only if auth is set tobasic
# Packages
No description provided by the author
# Functions
ConfigFromEnv creates an OpenSearch config object from environment variables.
GetConfig will get the Config object from the environment.
NewClientFromEnv creates an OpenSearch client pulling configurations from the environment.
# Constants
AuthBasic is the auth type to use if using the internal user database on the cluster.
AuthIAM is the auth type to use if not using the internal user database on the cluster.
AuthNone is the auth type to use if no auth is configured on the cluster.
ENV variable to control whether traces are send to datadog.
Identify the name of the trace in datadog.
# Variables
ErrMissingCredentials will be thrown when basic auth is configured but either username or password is not available.