config :coherence has incorrect values on setup
isAlmogK opened this issue · 4 comments
I followed the installation and setup based on the instructions provided but I have been running into a lot of errors and issues which all seem to be coming from the config :coherence
My project is magnify and when I do defmodule it's MagnifyWeb that is my naming all my controllers for example are "MagnifyWeb"
But when I look at config :coherence it's not here is the current version
config :coherence,
user_schema: Magnify.Coherence.User,
repo: Magnify.Repo,
module: Magnify,
web_module: MagnifyWeb,
router: Magnify.Router,
messages_backend: MagnifyWeb.Coherence.Messages,
logged_out_url: "/",
email_from_name: "Your Name",
email_from_email: "yourname@example.com",
opts: [:authenticatable, :recoverable, :lockable, :trackable, :unlockable_with_token, :invitable, :registerable]
config :coherence, Magnify.Coherence.Mailer,
adapter: Swoosh.Adapters.Sendgrid,
api_key: "your api key here"
I had to change messages_backend: Magnify.Coherence.Messages, to messages_backend: MagnifyWeb.Coherence.Messages, which solved an issue also web_module: Magnify.Web, to web_module: MagnifyWeb,
I'm now wondering what is correct? Should I also be changing user_schema: Magnify.Coherence.User, repo: Magnify.Repo, module: Magnify, router: Magnify.Router,
Why is this messed up?
Need more information. Please provide:
- version of Coherence
- the mix task you ran to install Coherence
- Copy ot you 'mix.exs' and 'config/config.exs fliles
Coherence version -- "0.5.0",
the mix task you ran to install Coherence -- First ran mix coherence.install --full-invitable and then tried mix coh.install --reinstall
Copy ot you 'mix.exs' and 'config/config.exs fliles
mix.exs
defmodule Magnify.Mixfile do
use Mix.Project
def project do
[
app: :magnify,
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {Magnify.Application, []},
extra_applications: [:logger, :runtime_tools, :coherence]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.3.2"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.10"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.15"},
{:cowboy, "~> 1.0"},
{:coherence, "~> 0.5"},
]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to create, migrate and run the seeds file at once:
#
# $ mix ecto.setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"test": ["ecto.create --quiet", "ecto.migrate", "test"]
]
end
end
config.exs
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# General application configuration
config :magnify,
ecto_repos: [Magnify.Repo]
# Configures the endpoint
config :magnify, MagnifyWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "8Rznx6smCS9tTPx/Xjv9rnxn9Q6TQt7/crZh73jq/V16yVfQIUSuVWRZhKXzcBD3",
render_errors: [view: MagnifyWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: Magnify.PubSub,
adapter: Phoenix.PubSub.PG2]
# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:user_id]
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"
# %% Coherence Configuration %% Don't remove this line
config :coherence,
user_schema: Magnify.Coherence.User,
repo: Magnify.Repo,
module: Magnify,
web_module: MagnifyWeb,
router: Magnify.Router,
messages_backend: MagnifyWeb.Coherence.Messages,
logged_out_url: "/",
email_from_name: "Your Name",
email_from_email: "yourname@example.com",
opts: [:authenticatable, :recoverable, :lockable, :trackable, :unlockable_with_token, :invitable, :registerable]
config :coherence, Magnify.Coherence.Mailer,
adapter: Swoosh.Adapters.Sendgrid,
api_key: "your api key here"
# %% End Coherence Configuration %%
I just created a new project with called Magnify and ran mix coh.install --full-invitable
and everything worked fine. I believe your issue was using coherence.install
for the initial installation. You should have ran coh.install
. If you remove the all the coherence installed files and the coherence config install with the correct installation task coh.install
everything should be fine.
However, version 0.5.0 has one issue (that has been resolved on master). In the generated Messages module, there one messages near the bottom of the file that uses <>
to concat two strings. This will not work with later version of Gettext. So you will need to remove the <>
and create one long string.
@smpallen99 thanks looks good now