fix settings doctests with undefined function refs

This commit is contained in:
Graham McIntire 2026-06-16 11:13:15 -05:00
parent 3c2e22fe0d
commit 13f5e8a487

View file

@ -15,14 +15,6 @@ defmodule Towerops.Settings do
Gets a setting by key and returns the parsed value.
Returns nil if the setting doesn't exist or has a nil value.
## Examples
iex> get_setting("global_default_cloud_poller_id")
"abc-123-uuid"
iex> get_setting("nonexistent_key")
nil
"""
def get_setting(key) when is_binary(key) do
case Repo.get_by(ApplicationSetting, key: key) do
@ -33,11 +25,6 @@ defmodule Towerops.Settings do
@doc """
Gets the raw ApplicationSetting record by key.
## Examples
iex> get_setting_record("global_default_cloud_poller_id")
%ApplicationSetting{key: "global_default_cloud_poller_id", value: "abc-123"}
"""
def get_setting_record(key) when is_binary(key) do
Repo.get_by(ApplicationSetting, key: key)
@ -45,14 +32,6 @@ defmodule Towerops.Settings do
@doc """
Updates a setting value, creating it if it doesn't exist.
## Examples
iex> update_setting("global_default_cloud_poller_id", "new-uuid")
{:ok, %ApplicationSetting{}}
iex> update_setting("global_default_cloud_poller_id", nil)
{:ok, %ApplicationSetting{value: nil}}
"""
def update_setting(key, value) when is_binary(key) do
case get_setting_record(key) do
@ -79,14 +58,6 @@ defmodule Towerops.Settings do
Gets the global default cloud poller agent token ID.
Returns nil if not configured.
## Examples
iex> get_global_default_cloud_poller()
"abc-123-uuid"
iex> get_global_default_cloud_poller()
nil
"""
def get_global_default_cloud_poller do
get_setting("global_default_cloud_poller_id")
@ -94,14 +65,6 @@ defmodule Towerops.Settings do
@doc """
Sets the global default cloud poller agent token ID.
## Examples
iex> set_global_default_cloud_poller("agent-token-uuid")
{:ok, %ApplicationSetting{}}
iex> set_global_default_cloud_poller(nil)
{:ok, %ApplicationSetting{value: nil}}
"""
def set_global_default_cloud_poller(agent_token_id) do
update_setting("global_default_cloud_poller_id", agent_token_id)
@ -109,11 +72,6 @@ defmodule Towerops.Settings do
@doc """
Lists all application settings.
## Examples
iex> list_all_settings()
[%ApplicationSetting{}, ...]
"""
def list_all_settings do
Repo.all(ApplicationSetting)