parent
69b6ae8467
commit
6a6bcd0084
1 changed files with 4 additions and 1 deletions
5
Makefile
5
Makefile
|
@ -145,7 +145,10 @@ deploy: dist
|
|||
## or copying the files directly to a sibling mattermost-server directory.
|
||||
ifneq ($(and $(MM_SERVICESETTINGS_SITEURL),$(MM_ADMIN_USERNAME),$(MM_ADMIN_PASSWORD),$(CURL)),)
|
||||
@echo "Installing plugin via API"
|
||||
$(eval TOKEN := $(shell curl -i --post301 --location $(MM_SERVICESETTINGS_SITEURL) -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login -d '{"login_id": "$(MM_ADMIN_USERNAME)", "password": "$(MM_ADMIN_PASSWORD)"}' | grep Token | cut -f2 -d' ' 2> /dev/null))
|
||||
$(eval TOKEN := $(shell curl -i --fail --post301 --location $(MM_SERVICESETTINGS_SITEURL) -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/users/login -d '{"login_id": "$(MM_ADMIN_USERNAME)", "password": "$(MM_ADMIN_PASSWORD)"}' | grep Token | cut -f2 -d' ' 2> /dev/null))
|
||||
@if [$(TOKEN) == '']; then\
|
||||
$(error Failed to authenticate and extract token using $(MM_ADMIN_USERNAME): check server logs.)\
|
||||
fi
|
||||
@curl -s --post301 --location $(MM_SERVICESETTINGS_SITEURL) -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins -F "plugin=@dist/$(BUNDLE_NAME)" -F "force=true" > /dev/null && \
|
||||
curl -s --post301 --location $(MM_SERVICESETTINGS_SITEURL) -H "Authorization: Bearer $(TOKEN)" -X POST $(MM_SERVICESETTINGS_SITEURL)/api/v4/plugins/$(PLUGIN_ID)/enable > /dev/null && \
|
||||
echo "OK." || echo "Sorry, something went wrong."
|
||||
|
|
Reference in a new issue