mthenw / serverless-go-plugin

⚡️ Serverless Framework plugin that compiles Go functions on the fly. Sponsored by https://cloudash.dev
https://cloudash.dev
MIT License
103 stars 17 forks source link

Feature request - Init command(s) #55

Open OranShuster opened 4 months ago

OranShuster commented 4 months ago

We use private git repositories as dependencies in our code For that we need to add our token to the github url so we can access those private repositories. Since serverless builds the functions concurrently the git config command is ran multiple times and crashes. As you can see in the code below we added a condition so this command will only run once.

'[ ! -f "$HOME/.gitconfig" ] && git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"; GOARCH=amd64 GOOS=linux go build -ldflags="-s -w"'

My feature request/suggestion is adding an init property to the config that will run only once before compilation, this will allow us to do whatever one time initialization we need