Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: exec remote script endpoint #64

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

svvimming
Copy link
Collaborator

Description

Endpoint added to execute a shell script which will live somewhere on the server and need to be accessible by the endpoint from an absolute path. The absolute path to the script as well as the script's filename will be stored as ENV variables in the open-panda backend packages. Likewise, the endpoint name is also stored as an ENV variable for the sake of obfuscation.

Still to be added:

  • the capacity to pass in arguments to the exec command

Ticket link

https://www.notion.so/agencyundone/Endpoint-that-executes-an-external-file-when-hit-2da36661d8464929ac90993c0746dd2f?pvs=4

@svvimming svvimming requested a review from orvn March 14, 2023 19:46
@svvimming svvimming self-assigned this Mar 14, 2023
@svvimming svvimming marked this pull request as draft March 14, 2023 19:46
@svvimming svvimming changed the title feat: endpoint added to execute shell script feat: exec remote script endpoint Mar 14, 2023
const path = req.query.path
const remoteProcess = executeRemoteProcess(command, path)
.then((result) => {
console.log(result)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orvn I was wondering if you wanted to console log the non-error output of the script / send it back as part of the successful response?

MC.app.get(REMOTE_EXEC_ENPOINT, async (req, res) => {
const command = req.query.command
const path = req.query.path
const remoteProcess = executeRemoteProcess(command, path)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orvn this function should be able to pass arguments from the get request into the shell script process. What should the structure look like coming from the query params? something like:

{
   foo: bar
}

gets passed to the script as:

--foo bar

@svvimming svvimming marked this pull request as ready for review March 15, 2023 17:04
@orvn
Copy link
Member

orvn commented May 24, 2023

I keep forgetting about this PR, it's still on my docket to take care of!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants