InflexDB v0.1.2 InflexDB.Client View Source

The client connection.

Url

By default connects to localhost:8086. But it can be changed in the client struct.

%InflexDB.Client{url: "http:://myinfluxdbinstance:8086"}

No authentication

By default the client has no authentication method.

%InflexDB.Client{auth_method: "none"}

Authenticate with Basic Authentication

Checkout the official InfluxDB docs on how to set up authentication in the server.

This is the preferred method for providing user credentials. Just set the auth_method option to basic. It will set the credentials as described in RFC 2617, Section 2 using the Authorization header in the request.

%InflexDB.Client{username: "admin", password: "admin", auth_method: "basic"}

Is possible use query params to provide the credentials. Just set the auth_method option to params.

%InflexDB.Client{username: "admin", password: "admin", auth_method: "params"}

Authenticate using JWT tokens

To authenticate using JWT tokens first add jose as dependency as it will be used to generate the tokens.

# mix.exs
{:jose, "~> 1.10"},

Then customize the client to incluse the shared secret and ttl in seconds of the tokens.

%InflexDB.Client{username: "admin", auth_method: "jwt", jwt_secret: "my super secret pass phrase", jwt_ttl: 60}

Each request made with the library will generate a new short-lived jwt token with the ttl defined.

Checkout the official InfluxDB docs on how configure the support for JWT tokens in the server.

Link to this section Summary

Link to this section Types

Link to this type

t()

View Source
t() :: %InflexDB.Client{
  auth_method: String.t(),
  jwt_secret: String.t() | nil,
  jwt_ttl: String.t() | nil,
  password: String.t() | nil,
  url: String.t(),
  username: String.t() | nil
}