[#2497] Added video preview proxy. Switched from exexec to Port.
parent
27e7999a15
commit
da116d81fb
@ -1,38 +0,0 @@
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Exec do
|
||||
@moduledoc "Pleroma wrapper around Exexec commands."
|
||||
|
||||
alias Pleroma.Config
|
||||
|
||||
def ensure_started(options_overrides \\ %{}) do
|
||||
options =
|
||||
if Config.get([:exexec, :root_mode]) || System.get_env("USER") == "root" do
|
||||
# Note: running as `root` is discouraged (yet Gitlab CI does that by default)
|
||||
%{root: true, user: "root", limit_users: ["root"]}
|
||||
else
|
||||
%{}
|
||||
end
|
||||
|
||||
options =
|
||||
options
|
||||
|> Map.merge(Config.get([:exexec, :options], %{}))
|
||||
|> Map.merge(options_overrides)
|
||||
|
||||
with {:error, {:already_started, pid}} <- Exexec.start(options) do
|
||||
{:ok, pid}
|
||||
end
|
||||
end
|
||||
|
||||
def run(cmd, options \\ %{}) do
|
||||
ensure_started()
|
||||
Exexec.run(cmd, options)
|
||||
end
|
||||
|
||||
def cmd(cmd, options \\ %{}) do
|
||||
options = Map.merge(%{sync: true, stdout: true}, options)
|
||||
run(cmd, options)
|
||||
end
|
||||
end
|
@ -1,13 +0,0 @@
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.ExecTest do
|
||||
alias Pleroma.Exec
|
||||
|
||||
use Pleroma.DataCase
|
||||
|
||||
test "it starts" do
|
||||
assert {:ok, _} = Exec.ensure_started()
|
||||
end
|
||||
end
|
Loading…
Reference in new issue