Fix xloader token creation
Removes unnecessary tokens previously created each time the script is executed.
This commit is contained in:
parent
75b7e7378c
commit
3f90532d05
|
@ -190,7 +190,9 @@ Use this if you are a maintainer and will not be making code changes to CKAN or
|
|||
> Please note that when accessing CKAN directly (via a browser) ie: not going through Apache/NGINX you will need to make sure you have "ckan" set up to be an alias to localhost in the local hosts file. Either that or you will need to change the `.env` entry for `CKAN_SITE_URL`
|
||||
|
||||
>**Warning**:<br>
|
||||
> Using the default values on the `.env` file will get you a working CKAN instance. There is a sysadmin user created by default with the values defined in `CKAN_SYSADMIN_NAME` and `CKAN_SYSADMIN_PASSWORD`(`ckan_admin` and `test1234` by default). **This should be obviously changed before running this setup as a public CKAN instance.**
|
||||
> Using the default values on the `.env` file will get you a working CKAN instance. There is a sysadmin user created by default with the values defined in `CKAN_SYSADMIN_NAME` and `CKAN_SYSADMIN_PASSWORD` (`ckan_admin` and `test1234` by default). All ennvars with `API_TOKEN` are automatically regenerated when CKAN is loaded, no editing is required.
|
||||
>
|
||||
>**This should be obviously changed before running this setup as a public CKAN instance.**
|
||||
|
||||
3. Build the images:
|
||||
```bash
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set the name of the token to revoke
|
||||
TOKEN_NAME="xloader"
|
||||
|
||||
# Get the list of tokens and extract the IDs for tokens with the specified name
|
||||
TOKEN_IDS=$(ckan -c $CKAN_INI user token list ckan_admin | grep "$TOKEN_NAME" | awk -F'[][]' '{print $2}' | tr -d '[]')
|
||||
|
||||
# Revoke each previous token of xloader
|
||||
for TOKEN_ID in $TOKEN_IDS
|
||||
do
|
||||
ckan -c $CKAN_INI user token revoke $TOKEN_ID
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "API Token $TOKEN_ID has been revoked"
|
||||
fi
|
||||
done
|
||||
|
||||
# Add ckanext.xloader.api_token to the CKAN config file
|
||||
echo "Loading ckanext-xloader settings in the CKAN config file"
|
||||
ckan config-tool $CKAN_INI \
|
||||
|
|
Loading…
Reference in New Issue