- `--dbuser DBUSER` - the user (aka role) to use for the database connection
- `--dbpass DBPASS` - the password to use for the database connection
- `--indexable Y/N` - Allow/disallow indexing site by search engines
+ - `--db-configurable Y/N` - Allow/disallow configuring instance from admin part
"""
def run(["gen" | rest]) do
dbname: :string,
dbuser: :string,
dbpass: :string,
- indexable: :string
+ indexable: :string,
+ db_configurable: :string
],
aliases: [
o: :output,
"y"
) === "y"
+ db_configurable? =
+ Common.get_option(
+ options,
+ :db_configurable,
+ "Do you want to be able to configure instance from admin part? (y/n)",
+ "y"
+ ) === "y"
+
dbhost =
Common.get_option(options, :dbhost, "What is the hostname of your database?", "localhost")
secret: secret,
signing_salt: signing_salt,
web_push_public_key: Base.url_encode64(web_push_public_key, padding: false),
- web_push_private_key: Base.url_encode64(web_push_private_key, padding: false)
+ web_push_private_key: Base.url_encode64(web_push_private_key, padding: false),
+ db_configurable?: db_configurable?
)
result_psql =
dbpass: dbpass
)
- Mix.shell().info(
+ Common.shell_info(
"Writing config to #{config_path}. You should rename it to config/prod.secret.exs or config/dev.secret.exs."
)
File.write(config_path, result_config)
- Mix.shell().info("Writing #{psql_path}.")
+ Common.shell_info("Writing #{psql_path}.")
File.write(psql_path, result_psql)
write_robots_txt(indexable)
- Mix.shell().info(
+ Common.shell_info(
"\n" <>
"""
To get started:
end
)
else
- Mix.shell().error(
+ Common.shell_error(
"The task would have overwritten the following files:\n" <>
(Enum.map(paths, &"- #{&1}\n") |> Enum.join("")) <>
"Rerun with `--force` to overwrite them."
if File.exists?(robots_txt_path) do
File.cp!(robots_txt_path, "#{robots_txt_path}.bak")
- Mix.shell().info("Backing up existing robots.txt to #{robots_txt_path}.bak")
+ Common.shell_info("Backing up existing robots.txt to #{robots_txt_path}.bak")
end
File.write(robots_txt_path, robots_txt)
- Mix.shell().info("Writing #{robots_txt_path}.")
+ Common.shell_info("Writing #{robots_txt_path}.")
end
end