<commit_before>defmodule RuntimeConfig do

  def blog_author do
    System.get_env("GLASNOST_BLOG_AUTHOR") || throw("GLASNOST_BLOG_AUTHOR is NOT configured")
  end

  def source_blockchain do
    System.get_env("GLASNOST_SOURCE_BLOCKCHAIN") || throw("GLASNOST_SOURCE_BLOCKCHAIN is NOT configured")
  end

  def blockchain_client_mod do
    case String.downcase(source_blockchain()) do
      "golos" -> Golos
      "steem" -> Steemex
    end
  end

  def language do
    case source_blockchain() do
      "golos" -> "ru"
      "steem" -> "en"
    end
  end
end<commit_msg>add external config loader prototype<commit_after>defmodule RuntimeConfig do

  def blog_author do
    System.get_env("GLASNOST_BLOG_AUTHOR") || throw("GLASNOST_BLOG_AUTHOR is NOT configured")
  end

  def source_blockchain do
    System.get_env("GLASNOST_SOURCE_BLOCKCHAIN") || throw("GLASNOST_SOURCE_BLOCKCHAIN is NOT configured")
  end

  def blockchain_client_mod do
    case String.downcase(source_blockchain()) do
      "golos" -> Golos
      "steem" -> Steemex
    end
  end

  def language do
    case source_blockchain() do
      "golos" -> "ru"
      "steem" -> "en"
    end
  end

  def fetch_external_config do
    url = System.get_env("GLASNOST_CONFIG_URL") || throw("GLASNOST_CONFIG_URL is NOT configured")
    with {:ok, %HTTPoison.Response{body: body}} <- HTTPoison.get(url),
      {:ok, config} <- Poison.Parser.parse(body)
    do
      config
    end
  end
end
{'fraction_non_alphanumeric': 0.09730848861283643, 'fraction_numerical': 0.0, 'mean_word_length': 3.5031055900621118, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6588286', 'n_tokens_mistral': 514, 'n_tokens_neox': 497, 'n_words': 116}