summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2022-12-17 14:01:18 +0000
committerJordan Bracco <href@random.sh>2022-12-20 19:29:41 +0100
commit67754dc5366976b0f4300af2d1798baa81423df5 (patch)
treeea7d78652e52e8e347f1976c4b2777cd6565462f
parentNola rename cont. pt. 2. Refs T77. (diff)
Nola rename, cont. pt. 3. Refs T77.
`s/:lsg/:nola/g`
-rw-r--r--lib/couch.ex2
-rw-r--r--lib/lsg/application.ex4
-rw-r--r--lib/lsg/icecast.ex2
-rw-r--r--lib/lsg/lsg.ex8
-rw-r--r--lib/lsg_irc/base_plugin.ex2
-rw-r--r--lib/lsg_irc/finance_plugin.ex2
-rw-r--r--lib/lsg_irc/last_fm_plugin.ex4
-rw-r--r--lib/lsg_irc/link_plugin.ex6
-rw-r--r--lib/lsg_irc/link_plugin/imgur.ex6
-rw-r--r--lib/lsg_irc/link_plugin/youtube.ex4
-rw-r--r--lib/lsg_irc/preums_plugin.ex2
-rw-r--r--lib/lsg_irc/sms_plugin.ex6
-rw-r--r--lib/lsg_irc/txt_plugin.ex4
-rw-r--r--lib/lsg_irc/txt_plugin/markov_py_markovify.ex4
-rw-r--r--lib/lsg_irc/wolfram_alpha_plugin.ex2
-rw-r--r--lib/lsg_irc/youtube_plugin.ex2
-rw-r--r--lib/lsg_telegram/room.ex4
-rw-r--r--lib/lsg_telegram/telegram.ex4
-rw-r--r--lib/lsg_web/controllers/irc_controller.ex2
-rw-r--r--lib/lsg_web/controllers/open_id_controller.ex2
-rw-r--r--lib/lsg_web/endpoint.ex4
-rw-r--r--lib/lsg_web/gettext.ex2
-rw-r--r--lib/open_ai.ex2
-rw-r--r--lib/untappd.ex2
24 files changed, 41 insertions, 41 deletions
diff --git a/lib/couch.ex b/lib/couch.ex
index e33c045..a4cf811 100644
--- a/lib/couch.ex
+++ b/lib/couch.ex
@@ -70,7 +70,7 @@ defmodule Couch do
end
defp prepare_request(path, headers \\ [], params \\ [], options \\ []) do
- config = Application.get_env(:lsg, :couch)
+ config = Application.get_env(:nola, :couch)
base_url = Keyword.get(config, :url, "http://localhost:5984")
diff --git a/lib/lsg/application.ex b/lib/lsg/application.ex
index 1782053..4f3d1da 100644
--- a/lib/lsg/application.ex
+++ b/lib/lsg/application.ex
@@ -45,9 +45,9 @@ defmodule Nola.Application do
end
defp start_telegram() do
- token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
+ token = Keyword.get(Application.get_env(:nola, :telegram, []), :key)
options = [
- username: Keyword.get(Application.get_env(:lsg, :telegram, []), :nick, "beauttebot"),
+ username: Keyword.get(Application.get_env(:nola, :telegram, []), :nick, "beauttebot"),
purge: false
]
telegram = Telegram.Bot.ChatBot.Supervisor.start_link({Nola.Telegram, token, options})
diff --git a/lib/lsg/icecast.ex b/lib/lsg/icecast.ex
index 60fb45a..5a53192 100644
--- a/lib/lsg/icecast.ex
+++ b/lib/lsg/icecast.ex
@@ -41,7 +41,7 @@ defmodule Nola.Icecast do
Logger.error "Icecast HTTP Error: #{inspect error}"
state
end
- interval = Application.get_env(:lsg, :icecast_poll_interval, 60_000)
+ interval = Application.get_env(:nola, :icecast_poll_interval, 60_000)
:timer.send_after(interval, :poll)
state
end
diff --git a/lib/lsg/lsg.ex b/lib/lsg/lsg.ex
index 11d0e24..0acb76e 100644
--- a/lib/lsg/lsg.ex
+++ b/lib/lsg/lsg.ex
@@ -7,8 +7,8 @@ defmodule Nola do
owner_email: "contact@my.nola.bot"
]
- def env(), do: Application.get_env(:lsg)
- def env(key, default \\ nil), do: Application.get_env(:lsg, key, default)
+ def env(), do: Application.get_env(:nola)
+ def env(key, default \\ nil), do: Application.get_env(:nola, key, default)
def brand(), do: env(:brand, @default_brand)
def brand(key), do: Keyword.get(brand(), key)
@@ -20,11 +20,11 @@ defmodule Nola do
end
def data_path do
- Application.get_env(:lsg, :data_path)
+ Application.get_env(:nola, :data_path)
end
def version do
- Application.spec(:lsg)[:vsn]
+ Application.spec(:nola)[:vsn]
end
end
diff --git a/lib/lsg_irc/base_plugin.ex b/lib/lsg_irc/base_plugin.ex
index ee0352e..a2b9ffb 100644
--- a/lib/lsg_irc/base_plugin.ex
+++ b/lib/lsg_irc/base_plugin.ex
@@ -109,7 +109,7 @@ defmodule Nola.IRC.BasePlugin do
end
def handle_info({:irc, :trigger, "version", message = %{trigger: %{type: :bang}}}, _) do
- {:ok, vsn} = :application.get_key(:lsg, :vsn)
+ {:ok, vsn} = :application.get_key(:nola, :vsn)
ver = List.to_string(vsn)
url = NolaWeb.Router.Helpers.irc_url(NolaWeb.Endpoint, :index)
elixir_ver = Application.started_applications() |> List.keyfind(:elixir, 0) |> elem(2) |> to_string()
diff --git a/lib/lsg_irc/finance_plugin.ex b/lib/lsg_irc/finance_plugin.ex
index c1a1771..16d06ee 100644
--- a/lib/lsg_irc/finance_plugin.ex
+++ b/lib/lsg_irc/finance_plugin.ex
@@ -183,7 +183,7 @@ defmodule Nola.IRC.FinancePlugin do
end
defp api_key() do
- Application.get_env(:lsg, :alphavantage, [])
+ Application.get_env(:nola, :alphavantage, [])
|> Keyword.get(:api_key, "demo")
end
diff --git a/lib/lsg_irc/last_fm_plugin.ex b/lib/lsg_irc/last_fm_plugin.ex
index f29982c..03df675 100644
--- a/lib/lsg_irc/last_fm_plugin.ex
+++ b/lib/lsg_irc/last_fm_plugin.ex
@@ -124,7 +124,7 @@ defmodule Nola.IRC.LastFmPlugin do
end
defp now_playing(user) do
- api = Application.get_env(:lsg, :lastfm)[:api_key]
+ api = Application.get_env(:nola, :lastfm)[:api_key]
url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&format=json&limit=1&extended=1" <> "&api_key=" <> api <> "&user="<> user
case HTTPoison.get(url) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} -> Jason.decode(body)
@@ -136,7 +136,7 @@ defmodule Nola.IRC.LastFmPlugin do
end
end
defp fetch_track(user, %{"recenttracks" => %{"track" => [ t = %{"name" => name, "artist" => %{"name" => artist}} | _]}}) do
- api = Application.get_env(:lsg, :lastfm)[:api_key]
+ api = Application.get_env(:nola, :lastfm)[:api_key]
url = "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&format=json" <> "&api_key=" <> api <> "&username="<> user <> "&artist="<>URI.encode(artist)<>"&track="<>URI.encode(name)
case HTTPoison.get(url) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
diff --git a/lib/lsg_irc/link_plugin.ex b/lib/lsg_irc/link_plugin.ex
index 28e537a..dee78e8 100644
--- a/lib/lsg_irc/link_plugin.ex
+++ b/lib/lsg_irc/link_plugin.ex
@@ -15,7 +15,7 @@ defmodule Nola.IRC.LinkPlugin do
## Configuration:
```
- config :lsg, Nola.IRC.LinkPlugin,
+ config :nola, Nola.IRC.LinkPlugin,
handlers: [
Nola.IRC.LinkPlugin.Youtube: [
invidious: true
@@ -112,7 +112,7 @@ defmodule Nola.IRC.LinkPlugin do
def expand_link(acc=[uri | _]) do
Logger.debug("link: expanding: #{inspect uri}")
- handlers = Keyword.get(Application.get_env(:lsg, __MODULE__, [handlers: []]), :handlers)
+ handlers = Keyword.get(Application.get_env(:nola, __MODULE__, [handlers: []]), :handlers)
handler = Enum.reduce_while(handlers, nil, fn({module, opts}, acc) ->
Logger.debug("link: attempt expanding: #{inspect module} for #{inspect uri}")
module = Module.concat([module])
@@ -162,7 +162,7 @@ defmodule Nola.IRC.LinkPlugin do
length = Map.get(headers, "content-length", "0")
{length, _} = Integer.parse(length)
- handlers = Keyword.get(Application.get_env(:lsg, __MODULE__, [handlers: []]), :handlers)
+ handlers = Keyword.get(Application.get_env(:nola, __MODULE__, [handlers: []]), :handlers)
handler = Enum.reduce_while(handlers, false, fn({module, opts}, acc) ->
module = Module.concat([module])
try do
diff --git a/lib/lsg_irc/link_plugin/imgur.ex b/lib/lsg_irc/link_plugin/imgur.ex
index af0b36a..5d74956 100644
--- a/lib/lsg_irc/link_plugin/imgur.ex
+++ b/lib/lsg_irc/link_plugin/imgur.ex
@@ -9,7 +9,7 @@ defmodule Nola.IRC.LinkPlugin.Imgur do
Needs to have a Imgur API key configured:
```
- config :lsg, :imgur,
+ config :nola, :imgur,
client_id: "xxxxxxxx",
client_secret: "xxxxxxxxxxxxxxxxxxxx"
```
@@ -46,7 +46,7 @@ defmodule Nola.IRC.LinkPlugin.Imgur do
end
def expand_imgur_image(image_id, opts) do
- client_id = Keyword.get(Application.get_env(:lsg, :imgur, []), :client_id, "42")
+ client_id = Keyword.get(Application.get_env(:nola, :imgur, []), :client_id, "42")
headers = [{"Authorization", "Client-ID #{client_id}"}]
options = []
case HTTPoison.get("https://api.imgur.com/3/image/#{image_id}", headers, options) do
@@ -65,7 +65,7 @@ defmodule Nola.IRC.LinkPlugin.Imgur do
end
def expand_imgur_album(album_id, opts) do
- client_id = Keyword.get(Application.get_env(:lsg, :imgur, []), :client_id, "42")
+ client_id = Keyword.get(Application.get_env(:nola, :imgur, []), :client_id, "42")
headers = [{"Authorization", "Client-ID #{client_id}"}]
options = []
case HTTPoison.get("https://api.imgur.com/3/album/#{album_id}", headers, options) do
diff --git a/lib/lsg_irc/link_plugin/youtube.ex b/lib/lsg_irc/link_plugin/youtube.ex
index 1e3a0de..f7c7541 100644
--- a/lib/lsg_irc/link_plugin/youtube.ex
+++ b/lib/lsg_irc/link_plugin/youtube.ex
@@ -7,7 +7,7 @@ defmodule Nola.IRC.LinkPlugin.YouTube do
needs an API key:
```
- config :lsg, :youtube,
+ config :nola, :youtube,
api_key: "xxxxxxxxxxxxx"
```
@@ -32,7 +32,7 @@ defmodule Nola.IRC.LinkPlugin.YouTube do
@impl true
def expand(uri, %{video_id: video_id}, opts) do
- key = Application.get_env(:lsg, :youtube)[:api_key]
+ key = Application.get_env(:nola, :youtube)[:api_key]
params = %{
"part" => "snippet,contentDetails,statistics",
"id" => video_id,
diff --git a/lib/lsg_irc/preums_plugin.ex b/lib/lsg_irc/preums_plugin.ex
index 9344ce9..f250e85 100644
--- a/lib/lsg_irc/preums_plugin.ex
+++ b/lib/lsg_irc/preums_plugin.ex
@@ -229,7 +229,7 @@ defmodule Nola.IRC.PreumsPlugin do
end
defp timezone(channel) do
- env = Application.get_env(:lsg, Nola.IRC.PreumsPlugin, [])
+ env = Application.get_env(:nola, Nola.IRC.PreumsPlugin, [])
channels = Keyword.get(env, :channels, %{})
channel_settings = Map.get(channels, channel, [])
default = Keyword.get(env, :default_tz, "Europe/Paris")
diff --git a/lib/lsg_irc/sms_plugin.ex b/lib/lsg_irc/sms_plugin.ex
index 2bbf13e..d8f7387 100644
--- a/lib/lsg_irc/sms_plugin.ex
+++ b/lib/lsg_irc/sms_plugin.ex
@@ -51,7 +51,7 @@ defmodule Nola.IRC.SmsPlugin do
end
def my_number() do
- Keyword.get(Application.get_env(:lsg, :sms, []), :number, "+33000000000")
+ Keyword.get(Application.get_env(:nola, :sms, []), :number, "+33000000000")
end
def start_link() do
@@ -59,7 +59,7 @@ defmodule Nola.IRC.SmsPlugin do
end
def path() do
- account = Keyword.get(Application.get_env(:lsg, :sms), :account)
+ account = Keyword.get(Application.get_env(:nola, :sms), :account)
"https://eu.api.ovh.com/1.0/sms/#{account}"
end
@@ -156,7 +156,7 @@ defmodule Nola.IRC.SmsPlugin do
end
defp env() do
- Application.get_env(:lsg, :sms)
+ Application.get_env(:nola, :sms)
end
defp env(key) do
diff --git a/lib/lsg_irc/txt_plugin.ex b/lib/lsg_irc/txt_plugin.ex
index d2bb627..cab912a 100644
--- a/lib/lsg_irc/txt_plugin.ex
+++ b/lib/lsg_irc/txt_plugin.ex
@@ -55,7 +55,7 @@ defmodule Nola.IRC.TxtPlugin do
def init([]) do
dets_locks_filename = (Nola.data_path() <> "/" <> "txtlocks.dets") |> String.to_charlist
{:ok, locks} = :dets.open_file(dets_locks_filename, [])
- markov_handler = Keyword.get(Application.get_env(:lsg, __MODULE__, []), :markov_handler, Nola.IRC.TxtPlugin.Markov.Native)
+ markov_handler = Keyword.get(Application.get_env(:nola, __MODULE__, []), :markov_handler, Nola.IRC.TxtPlugin.Markov.Native)
{:ok, markov} = markov_handler.start_link()
{:ok, _} = Registry.register(IRC.PubSub, "triggers", [plugin: __MODULE__])
{:ok, %__MODULE__{locks: locks, markov_handler: markov_handler, markov: markov, triggers: load()}}
@@ -516,7 +516,7 @@ defmodule Nola.IRC.TxtPlugin do
end
def directory() do
- Application.get_env(:lsg, :data_path) <> "/irc.txt/"
+ Application.get_env(:nola, :data_path) <> "/irc.txt/"
end
defp can_write?(%{rw: rw?, locks: locks}, msg = %{channel: nil, sender: sender}, trigger) do
diff --git a/lib/lsg_irc/txt_plugin/markov_py_markovify.ex b/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
index cda7853..b610ea8 100644
--- a/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
+++ b/lib/lsg_irc/txt_plugin/markov_py_markovify.ex
@@ -27,8 +27,8 @@ defmodule Nola.IRC.TxtPlugin.MarkovPyMarkovify do
end
defp script() do
- default_script = to_string(:code.priv_dir(:lsg)) <> "/irc/txt/markovify.py"
- env = Application.get_env(:lsg, Nola.IRC.TxtPlugin, [])
+ default_script = to_string(:code.priv_dir(:nola)) <> "/irc/txt/markovify.py"
+ env = Application.get_env(:nola, Nola.IRC.TxtPlugin, [])
|> Keyword.get(:py_markovify, [])
{Keyword.get(env, :python, "python3"), Keyword.get(env, :script, default_script)}
diff --git a/lib/lsg_irc/wolfram_alpha_plugin.ex b/lib/lsg_irc/wolfram_alpha_plugin.ex
index b553e63..6ee06f0 100644
--- a/lib/lsg_irc/wolfram_alpha_plugin.ex
+++ b/lib/lsg_irc/wolfram_alpha_plugin.ex
@@ -22,7 +22,7 @@ defmodule Nola.IRC.WolframAlphaPlugin do
def handle_info({:irc, :trigger, _, m = %IRC.Message{trigger: %IRC.Trigger{type: :bang, args: query}}}, state) do
query = Enum.join(query, " ")
params = %{
- "appid" => Keyword.get(Application.get_env(:lsg, :wolframalpha, []), :app_id, "NO_APP_ID"),
+ "appid" => Keyword.get(Application.get_env(:nola, :wolframalpha, []), :app_id, "NO_APP_ID"),
"units" => "metric",
"i" => query
}
diff --git a/lib/lsg_irc/youtube_plugin.ex b/lib/lsg_irc/youtube_plugin.ex
index 3d2acfb..fb9bea2 100644
--- a/lib/lsg_irc/youtube_plugin.ex
+++ b/lib/lsg_irc/youtube_plugin.ex
@@ -56,7 +56,7 @@ defmodule Nola.IRC.YouTubePlugin do
defp search(query) do
query = query
|> String.strip
- key = Application.get_env(:lsg, :youtube)[:api_key]
+ key = Application.get_env(:nola, :youtube)[:api_key]
params = %{
"key" => key,
"maxResults" => 1,
diff --git a/lib/lsg_telegram/room.ex b/lib/lsg_telegram/room.ex
index 794cca3..ca8a437 100644
--- a/lib/lsg_telegram/room.ex
+++ b/lib/lsg_telegram/room.ex
@@ -37,7 +37,7 @@ defmodule Nola.TelegramRoom do
@impl Telegram.ChatBot
def init(id) when is_integer(id) and id < 0 do
- token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
+ token = Keyword.get(Application.get_env(:nola, :telegram, []), :key)
{:ok, chat} = Api.request(token, "getChat", chat_id: id)
Logger.metadata(transport: :telegram, id: id, telegram_room_id: id)
tg_room = case room(id) do
@@ -164,7 +164,7 @@ defmodule Nola.TelegramRoom do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} <- HTTPoison.get(path),
<<smol_body::binary-size(20), _::binary>> = body,
{:ok, magic} <- GenMagic.Pool.perform(Nola.GenMagic, {:bytes, smol_body}),
- bucket = Application.get_env(:lsg, :s3, []) |> Keyword.get(:bucket),
+ bucket = Application.get_env(:nola, :s3, []) |> Keyword.get(:bucket),
ext = Path.extname(file["file_path"]),
s3path = "#{account.id}/#{file_unique_id}#{ext}",
s3req = ExAws.S3.put_object(bucket, s3path, body, acl: :public_read, content_type: magic.mime_type),
diff --git a/lib/lsg_telegram/telegram.ex b/lib/lsg_telegram/telegram.ex
index ef5c3b8..1c6a9a9 100644
--- a/lib/lsg_telegram/telegram.ex
+++ b/lib/lsg_telegram/telegram.ex
@@ -8,7 +8,7 @@ defmodule Nola.Telegram do
def send_message(id, text, md2 \\ false) do
md = if md2, do: "MarkdownV2", else: "Markdown"
- token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
+ token = Keyword.get(Application.get_env(:nola, :telegram, []), :key)
Telegram.Bot.ChatBot.Chat.Session.Supervisor.start_child(Nola.Telegram, id)
Telegram.Api.request(token, "sendMessage", chat_id: id, text: text, parse_mode: "Markdown")
end
@@ -135,7 +135,7 @@ defmodule Nola.Telegram do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} <- HTTPoison.get(path),
<<smol_body::binary-size(20), _::binary>> = body,
{:ok, magic} <- GenMagic.Pool.perform(Nola.GenMagic, {:bytes, smol_body}),
- bucket = Application.get_env(:lsg, :s3, []) |> Keyword.get(:bucket),
+ bucket = Application.get_env(:nola, :s3, []) |> Keyword.get(:bucket),
ext = Path.extname(file["file_path"]),
s3path = "#{account.id}/#{file_unique_id}#{ext}",
Telegram.Api.request(t, "editMessageText", chat_id: chat_id, message_id: m_id, text: "*Uploading...*", reply_markup: %{}, parse_mode: "MarkdownV2"),
diff --git a/lib/lsg_web/controllers/irc_controller.ex b/lib/lsg_web/controllers/irc_controller.ex
index 90d9853..c617e78 100644
--- a/lib/lsg_web/controllers/irc_controller.ex
+++ b/lib/lsg_web/controllers/irc_controller.ex
@@ -76,7 +76,7 @@ defmodule NolaWeb.IrcController do
end
defp data() do
- dir = Application.get_env(:lsg, :data_path) <> "/irc.txt/"
+ dir = Application.get_env(:nola, :data_path) <> "/irc.txt/"
Path.wildcard(dir <> "/*.txt")
|> Enum.reduce(%{}, fn(path, m) ->
path = String.split(path, "/")
diff --git a/lib/lsg_web/controllers/open_id_controller.ex b/lib/lsg_web/controllers/open_id_controller.ex
index 94166eb..d3fef5d 100644
--- a/lib/lsg_web/controllers/open_id_controller.ex
+++ b/lib/lsg_web/controllers/open_id_controller.ex
@@ -50,7 +50,7 @@ defmodule NolaWeb.OpenIdController do
end
defp new_client() do
- config = Application.get_env(:lsg, :oidc)
+ config = Application.get_env(:nola, :oidc)
OAuth2.Client.new([
strategy: OAuth2.Strategy.AuthCode,
client_id: config[:client_id],
diff --git a/lib/lsg_web/endpoint.ex b/lib/lsg_web/endpoint.ex
index d8bf962..b0cf9c5 100644
--- a/lib/lsg_web/endpoint.ex
+++ b/lib/lsg_web/endpoint.ex
@@ -1,13 +1,13 @@
defmodule NolaWeb.Endpoint do
use Sentry.PlugCapture
- use Phoenix.Endpoint, otp_app: :lsg
+ use Phoenix.Endpoint, otp_app: :nola
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
- at: "/", from: :lsg, gzip: false,
+ at: "/", from: :nola, gzip: false,
only: ~w(assets css js fonts images favicon.ico robots.txt)
# Code reloading can be explicitly enabled under the
diff --git a/lib/lsg_web/gettext.ex b/lib/lsg_web/gettext.ex
index e9a46e9..a43cb0d 100644
--- a/lib/lsg_web/gettext.ex
+++ b/lib/lsg_web/gettext.ex
@@ -20,5 +20,5 @@ defmodule NolaWeb.Gettext do
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
- use Gettext, otp_app: :lsg
+ use Gettext, otp_app: :nola
end
diff --git a/lib/open_ai.ex b/lib/open_ai.ex
index 81f12f4..cc0de27 100644
--- a/lib/open_ai.ex
+++ b/lib/open_ai.ex
@@ -1,7 +1,7 @@
defmodule OpenAi do
def post(path, data, options \\ []) do
- config = Application.get_env(:lsg, :openai, [])
+ config = Application.get_env(:nola, :openai, [])
url = "https://api.openai.com#{path}"
headers = [{"user-agent", "internal private experiment bot, href@random.sh"},
{"content-type", "application/json"},
diff --git a/lib/untappd.ex b/lib/untappd.ex
index d5ac904..7ed3e66 100644
--- a/lib/untappd.ex
+++ b/lib/untappd.ex
@@ -88,7 +88,7 @@ defmodule Untappd do
end
def env() do
- Application.get_env(:lsg, :untappd)
+ Application.get_env(:nola, :untappd)
end
end