+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Mix.Tasks.Pleroma.Instance do
use Mix.Task
- alias Pleroma.{Repo, User}
alias Mix.Tasks.Pleroma.Common
@shortdoc "Manages Pleroma instance"
proceed? = Enum.empty?(will_overwrite) or Keyword.get(options, :force, false)
unless not proceed? do
- domain =
- Common.get_option(
- options,
- :domain,
- "What domain will your instance use? (e.g pleroma.soykaf.com)"
- )
+ [domain, port | _] =
+ String.split(
+ Common.get_option(
+ options,
+ :domain,
+ "What domain will your instance use? (e.g pleroma.soykaf.com)"
+ ),
+ ":"
+ ) ++ [443]
name =
Common.get_option(
options,
- :name,
+ :instance_name,
"What is the name of your instance? (e.g. Pleroma/Soykaf)"
)
)
secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
+ {web_push_public_key, web_push_private_key} = :crypto.generate_key(:ecdh, :prime256v1)
result_config =
EEx.eval_file(
"sample_config.eex" |> Path.expand(__DIR__),
domain: domain,
+ port: port,
email: email,
name: name,
dbhost: dbhost,
dbuser: dbuser,
dbpass: dbpass,
version: Pleroma.Mixfile.project() |> Keyword.get(:version),
- secret: secret
+ secret: secret,
+ 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)
)
result_psql =