login consent app sql
This commit is contained in:
34
containers/loginappsql/composer-wrapper.sh
Executable file
34
containers/loginappsql/composer-wrapper.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
export COMPOSER_HOME=/tmp/composer
|
||||
|
||||
COMPOSER_AUTH="${COMPOSER_HOME}/auth.json"
|
||||
|
||||
function fix_composer_auth {
|
||||
if [ ! -f "${COMPOSER_AUTH}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
GITHUB_TOKEN=$(cat "${COMPOSER_AUTH}" | jq -r '.["github-oauth"]["github.com"]')
|
||||
|
||||
if [ ! -z "${GITHUB_TOKEN}" ]; then
|
||||
|
||||
GITHUB_USERNAME=$(cat "${COMPOSER_AUTH}" | jq -r '.["http-basic"]["github.com"].username')
|
||||
if [ -z "${GITHUB_USERNAME}" ]; then
|
||||
echo -n "Identifiant Github ? "
|
||||
read GITHUB_USERNAME
|
||||
fi
|
||||
|
||||
cat "${COMPOSER_AUTH}" | jq ".[\"http-basic\"][\"github.com\"] = {\"username\": \"${GITHUB_USERNAME}\", \"password\":\"${GITHUB_TOKEN}\"}" | sponge "${COMPOSER_AUTH}"
|
||||
cat "${COMPOSER_AUTH}" | jq "del(.[\"github-oauth\"])" | sponge "${COMPOSER_AUTH}"
|
||||
fi
|
||||
}
|
||||
|
||||
function main {
|
||||
fix_composer_auth
|
||||
php composer.phar ${@:1}
|
||||
}
|
||||
|
||||
main $@
|
Reference in New Issue
Block a user