Z.Configurations (Portico/Z v0.1.0)

Context module for ZSchemas.Configuration - runtime system config.

All configuration values are encrypted at rest using the Phoenix.Token functions. Upon retrieval the content value will be decrypted for use.

Link to this section Summary

Functions

Retrieves a ZSchemas.Configuration entry, by code.

Retrieves a ZSchemas.Configuration entry, by code.

Set a ZSchemas.Configuration value, using code as the access key.

Link to this section Functions

Specs

fetch(String.t()) :: {:ok, term()} | {:error, :not_found}

Retrieves a ZSchemas.Configuration entry, by code.

Returns {:ok, configuration} on success. Returns {:error, :not_found} if no matching entry is found.

Specs

get(String.t()) :: term()

Retrieves a ZSchemas.Configuration entry, by code.

Returns nil if no entry is found.

Link to this function

set(code, content, opts \\ [])

Specs

set(String.t(), term(), Keyword.t()) ::
  {:ok,
   %ZSchemas.Configuration{
     __meta__: term(),
     code: term(),
     content: term(),
     id: term(),
     inserted_at: term(),
     updated_at: term()
   }}
  | {:error, term()}

Set a ZSchemas.Configuration value, using code as the access key.

Any opts will be passed to the (private) encrypt/2 function.