From cf53e300f8e850aeacb88e6e6b4d465378acc199 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Fri, 7 Aug 2020 15:55:08 +0300 Subject: [PATCH] added generate the release env to `pleroma.instance gen` --- docs/administration/CLI_tasks/instance.md | 1 + docs/installation/debian_based_en.md | 3 --- lib/mix/tasks/pleroma/instance.ex | 13 ++++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/administration/CLI_tasks/instance.md b/docs/administration/CLI_tasks/instance.md index d6913280a..d922b44df 100644 --- a/docs/administration/CLI_tasks/instance.md +++ b/docs/administration/CLI_tasks/instance.md @@ -40,3 +40,4 @@ If any of the options are left unspecified, you will be prompted interactively. - `--strip-uploads ` - use ExifTool to strip uploads of sensitive location data - `--anonymize-uploads ` - randomize uploaded filenames - `--dedupe-uploads ` - store files based on their hash to reduce data storage requirements if duplicates are uploaded with different filenames +- `--skip-release-env` - skip generation the release environment file diff --git a/docs/installation/debian_based_en.md b/docs/installation/debian_based_en.md index 6badfeed7..b9fc4e112 100644 --- a/docs/installation/debian_based_en.md +++ b/docs/installation/debian_based_en.md @@ -101,9 +101,6 @@ sudo -Hu pleroma mix deps.get mv config/{generated_config.exs,prod.secret.exs} ``` -* Generate the environment file: `sudo -Hu pleroma mix pleroma.release_env gen` - * Input path to env file or keep default value `./config/pleroma.env` - * The previous command creates also the file `config/setup_db.psql`, with which you can create the database: diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index fc21ae062..caa7dfbd3 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -36,7 +36,8 @@ def run(["gen" | rest]) do listen_port: :string, strip_uploads: :string, anonymize_uploads: :string, - dedupe_uploads: :string + dedupe_uploads: :string, + skip_release_env: :boolean ], aliases: [ o: :output, @@ -241,6 +242,16 @@ def run(["gen" | rest]) do write_robots_txt(static_dir, indexable, template_dir) + if Keyword.get(options, :skip_release_env, false) do + shell_info(""" + Release environment file is skip. Please generate the release env file before start. + `MIX_ENV=#{Mix.env()} mix pleroma.release_env gen` + """) + else + shell_info("Generation the environment file:") + Mix.Tasks.Pleroma.ReleaseEnv.run(["gen"]) + end + shell_info( "\n All files successfully written! Refer to the installation instructions for your platform for next steps." )