Skip to content

Commit

Permalink
Rename AVATAR_PROVIDER to DEFAULT_AVATAR
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Jun 15, 2024
1 parent 85d474f commit 32e41f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ config :asciinema, Asciinema.FileStore.Local, path: "uploads/"

config :asciinema, Asciinema.FileCache, path: "cache/"

config :asciinema, :avatar_provider, :identicon
config :asciinema, :default_avatar, :identicon

config :asciinema, :png_generator, Asciinema.PngGenerator.Rsvg

Expand Down
6 changes: 3 additions & 3 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ if config_env() in [:prod, :dev] do
config :asciinema, :sign_up_enabled?, false
end

provider = env.("AVATAR_PROVIDER")
avatar = env.("DEFAULT_AVATAR")

if provider in ["gravatar", "identicon"] do
config :asciinema, :avatar_provider, String.to_existing_atom(provider)
if avatar in ["gravatar", "identicon"] do
config :asciinema, :default_avatar, String.to_existing_atom(avatar)
end

if dsn = env.("SENTRY_DSN") do
Expand Down
2 changes: 1 addition & 1 deletion lib/asciinema_web/controllers/user_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule AsciinemaWeb.UserHTML do
defdelegate default_font_display_name, to: Fonts

def avatar_url(user) do
avatar_url(user, Application.fetch_env!(:asciinema, :avatar_provider))
avatar_url(user, Application.fetch_env!(:asciinema, :default_avatar))
end

def avatar_url(user, :identicon), do: ~p"/u/#{user}/avatar"
Expand Down

0 comments on commit 32e41f5

Please sign in to comment.