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

Feature Request - allow alias to be run using infisical run #457

Open
fmancardi opened this issue Mar 21, 2023 · 8 comments
Open

Feature Request - allow alias to be run using infisical run #457

fmancardi opened this issue Mar 21, 2023 · 8 comments
Labels
🚀 feature request New feature or request help wanted Open for contributions from the community

Comments

@fmancardi
Copy link

Feature description

I would like to be able to using: infisical run to run an alias

infisical run -- rcxx-preprod blind

rccno-prepod is the following alias:

alias rcxx-preprod='./runners/runit.chrome.cxx-preprod.sh'

When running rcnno-preprod, it will be expanded to:
testcafe 'chrome --start-fullscreen' --cfg=cxx-preprod.json ./test/blind-man-navigation.js

Why would it be useful?

To have shortcut to long commands

Right now what you get is this error:

Injecting 2 Infisical secrets into your application process
Hmm, we ran into an error: exec: "rcxx-preprod": executable file not found in %PATH%Unable to execute your single command

Environment

gitbash on windows 11

@maidul98 maidul98 added the 🚀 feature request New feature or request label Mar 23, 2023
@maidul98
Copy link
Collaborator

Great idea!

@maidul98 maidul98 added the help wanted Open for contributions from the community label Apr 7, 2023
@quinton11
Copy link
Contributor

quinton11 commented Apr 7, 2023

Hey @maidul98, I looked into this. A quick fix would be to check if the command exists in %PATH% (alias check), get the 'SHELL' environment variable and run the command as a sub command. ( In

func executeSingleCommandWithEnvs(args []string, secretsCount int, env []string) error {
)

Eg: '[SHELL] -c [aliasCmd]' for git bash: '[/path/to/bash] -c [aliasCmd]'

However aliases aren't passed to sub processes. As a work around, in substitute for aliases, you could create a function in your .bashrc / bash_profile.sh which returns the cmd you're aliasing and export it.

See https://askubuntu.com/a/98791

@parthvnp
Copy link
Contributor

Is help still needed on this issue? I would love to work on it!

@maidul98
Copy link
Collaborator

@quinton11 that makes sense and to source the file you can also just point to a script file. This way we can do something like this which already works out of the box

infisical run --command="source ./myfunctions.sh && ll"

where myfunctions.sh is

#!/bin/sh

ll() {
  ls -l "$@"
}

I think adding this to the documentation should help others become aware of this. What do you think @parthvnp @quinton11

@quinton11
Copy link
Contributor

Yep, sounds great... would you handle updating the documentation? I can pick it up if not. Or perhaps @parthvnp ?

@parthvnp
Copy link
Contributor

parthvnp commented Apr 26, 2023

I can handle the updating documentation !

@maidul98
Copy link
Collaborator

Cool, we use https://mintlify.com/ so feed free to cd into the docs folder and start up mintlify with mintlify dev command after you install it

@parthvnp
Copy link
Contributor

@maidul98 Added PR 564 to showcase this feature in documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feature request New feature or request help wanted Open for contributions from the community
Projects
None yet
Development

No branches or pull requests

4 participants