Created
March 3, 2016 02:37
-
-
Save johnhamelink/923c12b918f826fcfa39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Api.Discovery do | |
| require Logger | |
| def discover do | |
| # Attempt to connect to any other outside nodes. | |
| # This command makes use of the /opt/api/.hosts.erlang file | |
| hosts_path = Path.expand("/opt/api/.hosts.erlang") | |
| case File.exists?(hosts_path) do | |
| true -> | |
| Logger.info("Attempting to join cluster") | |
| :net_adm.world(:verbose) | |
| false -> | |
| Logger.warn("Couldn't find #{hosts_path} file - not joining cluster") | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment