Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Version 3 of the Erlang SDK requires Gun 2.x. To learn more about upgrading, read Erlang (server-side) SDK 2.x to 3.0 migration guide.
Overview
This topic documents how to get started with the Erlang SDK, and links to reference information on all of the supported features.LaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and sample applications:
| Resource | Location |
|---|---|
| SDK API documentation | SDK API docs |
| Supported SDK Versions | Erlang server SDK |
| GitHub repository | erlang-server-sdk |
| Sample applications | Erlang , Elixir , Phoenix |
| Published module | Hex |
Get started
Follow the steps below to get started using the LaunchDarkly SDK in your Erlang application. First, download the dependency using Rebar:app.src file:
The Erlang SDK uses an SDK key. Keys are specific to each project and environment. They are available from Project settings, on the Environments list. To learn more about key types, read Keys.
Initialize the client
After you install the SDK dependency, create an instance of the client. Specify your SDK key here to authorize your application to connect to a particular environment within LaunchDarkly. Here is an example:ldclient_config.
Evaluate a context
Next, check which flag variation a specific context should receive:Transport Layer Security (TLS)
The SDK includes configuration options that allow you to set custom TLS options. If you don’t set these options, then the SDK will use the Erlang/OTP defaults. The default TLS connection settings in Erlang/OTP do not validate the identity or authenticity of certificates. If your application has existing TLS options, then you can pass them to the SDK:ldclient_config:tls_basic_options(): This helper provides a basic TLS configuration suitable for development. It tries to use a CA store in the default location for many linux distributions (/etc/ssl/certs/ca-certificates.crt). If it can’t find the store, then it will use the store from thecertifipackage.ldclient_config:tls_basic_linux_options(): This helper provides a basic TLS configuration for linux. It uses the CA store located at/etc/ssl/certs/ca-certificates.crt.ldclient_config:tls_ca_certfile_options(CaStorePath): This helper provides a basic TLS configuration with the CA store you specify.ldclient_config:tls_basic_certifi_options(): This helper provides a basic TLS configuration that uses thecertifistore. Because this store is from a dependency of the package, it is not maintained or updated by OS releases.ldclient_config:with_tls_revocation(TlsOptions): This helper extends a TLS configuration with certificate revocation. Revocation is not included in the basic configuration because the Erlang/OTP does not cache revocation results. Enabling this feature incurs additional requests per request the SDK makes.
Shut down the client
Shut down the client when your application terminates. To learn more, read Shutting down.Supported features
This SDK supports the following features:- Anonymous contexts and users
- Configuration, including
- Context configuration
- Evaluating flags
- Flag evaluation reasons
- Getting all flags
- Identifying and changing contexts
- Offline mode
- Private attributes
- Reading flags from a file
- Relay Proxy configuration
- Sending custom events
- Shutting down
- Storing data
- Test data sources