Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update supervisor child_spec #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/ex_ngrok.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ defmodule Ngrok do
import Supervisor.Spec, warn: false

children = [
worker(Ngrok.Executable, []),
worker(Ngrok.Settings, []),
{Ngrok.Executable, []},
{Ngrok.Settings, []}
]

opts = [strategy: :rest_for_one, name: Ngrok.Supervisor]
Expand Down
2 changes: 1 addition & 1 deletion lib/executable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Ngrok.Executable do
"""
use GenServer

def start_link do
def start_link(_init_arg) do
GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
end

Expand Down
8 changes: 7 additions & 1 deletion lib/settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ defmodule Ngrok.Settings do
- See: https://ngrok.com/docs#list-tunnels
"""
require Logger

use GenServer

def start_link do
def start_link(_init_arg) do
Agent.start_link(fn -> fetch_and_announce_settings() end, name: __MODULE__)
end

def init(:ok) do
{:ok, true}
end

@doc """
Retrieves a setting by name from the Ngrok tunnel
Expand Down