View Source Lightning.SetupUtils (Lightning v2.10.4)

SetupUtils encapsulates logic for setting up initial data for various sites.

Summary

Functions

Creates initial data and returns the created records.

In some (mostly remote-controlled) deployments, it's necessary to create a user, and apiToken, and multiple credentials (owned by the user) so that later openfn deploy calls can make use of these artifacts.

Functions

Link to this function

create_dhis2_project(project_users)

View Source
Link to this function

create_openhie_project(project_users)

View Source
Link to this function

create_starter_project(name, project_users)

View Source
Link to this function

setup_demo(opts \\ [create_super: false])

View Source
@spec setup_demo(nil | maybe_improper_list() | map()) :: %{
  jobs: [...],
  projects: [atom() | %{:id => any(), optional(any()) => any()}, ...],
  users: [atom() | %{:id => any(), optional(any()) => any()}, ...],
  workflows: [atom() | %{:id => any(), optional(any()) => any()}, ...],
  workorders: [atom() | %{:id => any(), optional(any()) => any()}, ...]
}

Creates initial data and returns the created records.

Link to this function

setup_user(user, token \\ nil, credentials \\ nil)

View Source
@spec setup_user(map(), String.t() | nil, [map()] | nil) :: :ok | {:error, any()}

In some (mostly remote-controlled) deployments, it's necessary to create a user, and apiToken, and multiple credentials (owned by the user) so that later openfn deploy calls can make use of these artifacts.

When run before openfn deploy, this function makes it possible to set up an entire lightning instance with a working project (including secrets) without using the web UI.

Examples

iex> setup_user(%{email: "td@openfn.org", first_name: "taylor", last_name: "downs", password: "shh12345!"}, "secretToken", [%{name: "openmrs", schema: "raw", body: %{"a" => "secret"}}, %{ name: "dhis2", schema: "raw", body: %{"b" => "safe"}}]) :ok

Link to this function

tear_down(opts \\ [destroy_super: false])

View Source