Merge develop
[akkoma] / lib / mix / tasks / pleroma / instance.ex
index 8f8d86a1120c5b402ea31b72d0f0dfb0e5291bcb..d276df93acf0ace3caf5593a909f4d9ef46c2b42 100644 (file)
@@ -24,10 +24,12 @@ defmodule Mix.Tasks.Pleroma.Instance do
   - `--domain DOMAIN` - the domain of your instance
   - `--instance-name INSTANCE_NAME` - the name of your instance
   - `--admin-email ADMIN_EMAIL` - the email address of the instance admin
+  - `--notify-email NOTIFY_EMAIL` - email address for notifications
   - `--dbhost HOSTNAME` - the hostname of the PostgreSQL database to use
   - `--dbname DBNAME` - the name of the database to use
   - `--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
   """
 
   def run(["gen" | rest]) do
@@ -41,10 +43,12 @@ defmodule Mix.Tasks.Pleroma.Instance do
           domain: :string,
           instance_name: :string,
           admin_email: :string,
+          notify_email: :string,
           dbhost: :string,
           dbname: :string,
           dbuser: :string,
-          dbpass: :string
+          dbpass: :string,
+          indexable: :string
         ],
         aliases: [
           o: :output,
@@ -61,7 +65,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
     will_overwrite = Enum.filter(paths, &File.exists?/1)
     proceed? = Enum.empty?(will_overwrite) or Keyword.get(options, :force, false)
 
-    unless not proceed? do
+    if proceed? do
       [domain, port | _] =
         String.split(
           Common.get_option(
@@ -81,6 +85,14 @@ defmodule Mix.Tasks.Pleroma.Instance do
 
       email = Common.get_option(options, :admin_email, "What is your admin email address?")
 
+      notify_email =
+        Common.get_option(
+          options,
+          :notify_email,
+          "What email address do you want to use for sending email notifications?",
+          email
+        )
+
       indexable =
         Common.get_option(
           options,
@@ -113,6 +125,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
         )
 
       secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
+      jwt_secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
       signing_salt = :crypto.strong_rand_bytes(8) |> Base.encode64() |> binary_part(0, 8)
       {web_push_public_key, web_push_private_key} = :crypto.generate_key(:ecdh, :prime256v1)
 
@@ -122,6 +135,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
           domain: domain,
           port: port,
           email: email,
+          notify_email: notify_email,
           name: name,
           dbhost: dbhost,
           dbname: dbname,
@@ -129,6 +143,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
           dbpass: dbpass,
           version: Pleroma.Mixfile.project() |> Keyword.get(:version),
           secret: secret,
+          jwt_secret: jwt_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)