This commit is contained in:
Maksim Pechnikov 2020-08-08 06:49:19 +03:00
parent cf53e300f8
commit 2030ffd490
3 changed files with 22 additions and 3 deletions

View file

@ -41,3 +41,4 @@ If any of the options are left unspecified, you will be prompted interactively.
- `--anonymize-uploads <Y|N>` - randomize uploaded filenames
- `--dedupe-uploads <Y|N>` - 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
- `--release-env-file` - release environment file path

View file

@ -37,7 +37,8 @@ defmodule Mix.Tasks.Pleroma.Instance do
strip_uploads: :string,
anonymize_uploads: :string,
dedupe_uploads: :string,
skip_release_env: :boolean
skip_release_env: :boolean,
release_env_file: :string
],
aliases: [
o: :output,
@ -249,7 +250,15 @@ defmodule Mix.Tasks.Pleroma.Instance do
""")
else
shell_info("Generation the environment file:")
Mix.Tasks.Pleroma.ReleaseEnv.run(["gen"])
release_env_args =
with path when not is_nil(path) <- Keyword.get(options, :release_env_file) do
["gen", "--path", path]
else
_ -> ["gen"]
end
Mix.Tasks.Pleroma.ReleaseEnv.run(release_env_args)
end
shell_info(

View file

@ -5,6 +5,8 @@
defmodule Mix.Tasks.Pleroma.InstanceTest do
use ExUnit.Case
@release_env_file "./test/pleroma.test.env"
setup do
File.mkdir_p!(tmp_path())
@ -16,6 +18,8 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do
File.rm_rf(Path.join(static_dir, "robots.txt"))
end
if File.exists?(@release_env_file), do: File.rm_rf(@release_env_file)
Pleroma.Config.put([:instance, :static_dir], static_dir)
end)
@ -69,7 +73,9 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do
"--dedupe-uploads",
"n",
"--anonymize-uploads",
"n"
"n",
"--release-env-file",
@release_env_file
])
end
@ -91,6 +97,9 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do
assert generated_config =~ "filters: [Pleroma.Upload.Filter.ExifTool]"
assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql()
assert File.exists?(Path.expand("./test/instance/static/robots.txt"))
assert File.exists?(@release_env_file)
assert File.read!(@release_env_file) =~ ~r/^RELEASE_COOKIE=.*/
end
defp generated_setup_psql do