Fly (Fly RPC v0.2.0) View Source

Functions and features to help Elixir applications more easily take advantage of the features that Fly.io provides.

Link to this section Summary

Functions

Return if the app instance is running in the primary region or not. Boolean result.

Return the configured current region. Reads the FLY_REGION ENV setting available when deployed on the Fly.io platform. When running on a different platform, that ENV value will not be set. Setting the MY_REGION ENV value instructs the node how to identify what "region" it is in. If not set, it returns "local".

Return the configured primary region. Reads and requires an ENV setting for PRIMARY_REGION. If not set, it returns "local".

Execute the MFA on a node in the primary region.

Link to this section Functions

Specs

is_primary?() :: no_return() | boolean()

Return if the app instance is running in the primary region or not. Boolean result.

Specs

my_region() :: String.t()

Return the configured current region. Reads the FLY_REGION ENV setting available when deployed on the Fly.io platform. When running on a different platform, that ENV value will not be set. Setting the MY_REGION ENV value instructs the node how to identify what "region" it is in. If not set, it returns "local".

The value itself is not important. If the value matches the value for the PRIMARY_REGION then it behaves as though it is the primary.

Specs

primary_region() :: String.t()

Return the configured primary region. Reads and requires an ENV setting for PRIMARY_REGION. If not set, it returns "local".

Link to this function

rpc_primary(module, func, args, opts \\ [])

View Source

Specs

rpc_primary(module(), atom(), [any()], keyword()) :: any()

Execute the MFA on a node in the primary region.