Files
ubicloud/routes/cli.rb
Jeremy Evans cbf2d95cbb Revert the backout of the CLI support
This reverts commit b741fe9005.

This was backed out as problems started occuring shortly after
a large CLI pull request was merged.  However, log analysis
shows that the CLI was unrelated to the problems.
2025-02-11 16:09:46 -08:00

19 lines
554 B
Ruby

# frozen_string_literal: true
class Clover
hash_branch("cli") do |r|
r.post api? do
response["content-type"] = "text/plain"
unless (argv = r.POST["argv"]).is_a?(Array) && argv.all?(String)
response.status = 400
next "Invalid request: No or invalid argv parameter provided"
end
project_id = env["clover.project_id"] = ApiKey.where(id: rodauth.session["pat_id"]).get(:project_id)
env["clover.project_ubid"] = UBID.from_uuidish(project_id).to_s
r.halt UbiCli.process(argv, env)
end
end
end