Merge branch 'feat/openapi-spec-export' into 'develop'
[akkoma] / lib / mix / tasks / pleroma / instance.ex
index 853c4eaa26fe1456dce6d04cdfb75fe9c862c564..da27a99d0e7b4efc0be49c35fb7fe23a38ab477d 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Mix.Tasks.Pleroma.Instance do
@@ -242,6 +242,13 @@ defmodule Mix.Tasks.Pleroma.Instance do
           rum_enabled: rum_enabled
         )
 
+      config_dir = Path.dirname(config_path)
+      psql_dir = Path.dirname(psql_path)
+
+      [config_dir, psql_dir, static_dir, uploads_dir]
+      |> Enum.reject(&File.exists?/1)
+      |> Enum.map(&File.mkdir_p!/1)
+
       shell_info("Writing config to #{config_path}.")
 
       File.write(config_path, result_config)
@@ -275,10 +282,6 @@ defmodule Mix.Tasks.Pleroma.Instance do
         indexable: indexable
       )
 
-    unless File.exists?(static_dir) do
-      File.mkdir_p!(static_dir)
-    end
-
     robots_txt_path = Path.join(static_dir, "robots.txt")
 
     if File.exists?(robots_txt_path) do