-
Notifications
You must be signed in to change notification settings - Fork 2
Import old users
Importing users from the old OH internal project is done through the manage.py import_users
management command and requires a CSV file that contains two rows (project_member_id and refresh_token) to be present on the heroku instance in which the command should be run.
The easiest way to upload such a file is transfer.sh
. The workflow is the following:
On your local machine with the CSV file run the following:
cat import_user_file.csv|gpg -ac -o-| \
curl -H "Max-Downloads: 1" -X PUT --upload-file "-" https://transfer.sh/tokens.csv
This command
- first encrypts the CSV file (using
gpg
- you will be asked to provide a password that will also be used for the decryption) - Uploads the file to
transfer.sh
, while specifying that it can only be downloaded once before being destroyed.
In the end it will print a transfer.sh
link that you can use to download the encrypted copy of your file.
Now we want to download the file to our heroku
deployment of this repository.
The best way to do all the following steps is with a single bash:
heroku run:bash
will fire up a new heroku dyno and you'll end up in the bash
, ready for everything else.
On the heroku
bash you can now do curl https://transfer.sh/mylink/tokens.csv|gpg -o- > tokens.csv
to download and decrypt your uploaded CSV file in one go. gpg
will ask you to enter the password that you also used for the encryption during the upload.
Now that you have your file on the heroku bash
you can start the management command like this:
manage.py import_users --infile tokens.csv --delimiter ","
It should quickly import all the users from the old integration and with that you're good to go. As soon as you type exit
in your heroku
bash
the dyno will be destroyed and your temporary input file for the import will vanish with that.