Add syanpse URL and admin password variables
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
e8adba9d68
commit
818a975b45
|
@ -1,4 +1,6 @@
|
|||
SYNAPSE_URL='http://localhost:8008'
|
||||
REGISTRATION_SHARED_SECRET='look in your synapses homeserver.yaml'
|
||||
AS_TOKEN='look in the app-service.yaml'
|
||||
EXCLUDED_USERS='rocket.cat' # Comma-separated list of usernames or IDs
|
||||
ADMIN_USERNAME='admin' # The login name of the Rocket.Chat admin
|
||||
ADMIN_USERNAME='admin' # The login name of the Rocket.Chat admin/new Matrix admin
|
||||
ADMIN_PASSWORD='verySecretPassword' # The password of the Rocket.Chat admin/new Matrix admin
|
||||
|
|
|
@ -56,7 +56,7 @@ app_service_config_files:
|
|||
|
||||
Now edit `app-service.example.yaml` and save it at `files/app-service.yaml`, changing the tokens manually.
|
||||
|
||||
Copy over `.env.example` to `.env` and insert your values. Also export the admin name by `export ADMIN_USERNAME=yourValue`, where you replace `yourValue` with what you set in the file.
|
||||
Copy over `.env.example` to `.env` and insert your values. Also export the variables with `source .env`.
|
||||
|
||||
### Starting the Matrix Dev Server
|
||||
|
||||
|
@ -65,10 +65,10 @@ Boot up the container and (for the first time starting the server or after reset
|
|||
```shell
|
||||
docker-compose up -d
|
||||
# Wait for the Server to boot, then register an admin user
|
||||
docker-compose exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml --admin --user $ADMIN_USERNAME --password $ADMIN_USERNAME
|
||||
docker-compose exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml --admin --user $ADMIN_USERNAME --password $ADMIN_PASSWORD
|
||||
```
|
||||
|
||||
Then you can access the homeserver in [Element Web](https://app.element.io/#/login) or the [local admin interface](http://localhost:8080) as `http://localhost:8008` with your `$ADMIN_USERNAME`/`yourValue` as username AND password.
|
||||
Then you can access the homeserver in [Element Web](https://app.element.io/#/login) or the [local admin interface](http://localhost:8080) as `http://localhost:8008` with your `$ADMIN_USERNAME`/`$ADMIN_PASSWORD` as username/password.
|
||||
|
||||
Store an access token for that user:
|
||||
|
||||
|
@ -76,7 +76,7 @@ Store an access token for that user:
|
|||
curl --request POST \
|
||||
--url http://localhost:8008/_matrix/client/v3/login \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data "{\"type\": \"m.login.password\",\"user\": \"$ADMIN_USERNAME\",\"password\": \"$ADMIN_USERNAME\",\"device_id\": \"DEV\"}" \
|
||||
--data "{\"type\": \"m.login.password\",\"user\": \"$ADMIN_USERNAME\",\"password\": \"$ADMIN_PASSWORD\",\"device_id\": \"DEV\"}" \
|
||||
> src/config/synapse_access_token.json
|
||||
```
|
||||
|
||||
|
|
14
reset.sh
14
reset.sh
|
@ -2,11 +2,17 @@
|
|||
set -eo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
HOMESERVER="http://localhost:8008"
|
||||
set -a # automatically export all variables
|
||||
source .env
|
||||
set +a
|
||||
|
||||
if [ -z "$SYNAPSE_URL" ]
|
||||
then
|
||||
# shellcheck disable=SC2016
|
||||
echo 'Variable $SYNAPSE_URL is not set in .env. Exiting.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$ADMIN_USERNAME" ]
|
||||
then
|
||||
# shellcheck disable=SC2016
|
||||
|
@ -24,7 +30,7 @@ docker-compose up -d
|
|||
sleep 1.5
|
||||
echo 'Creating admin user'
|
||||
set +e
|
||||
until docker-compose exec -it synapse register_new_matrix_user $HOMESERVER -c /data/homeserver.yaml --admin --user $ADMIN_USERNAME --password $ADMIN_USERNAME &> /dev/null
|
||||
until docker-compose exec -it synapse register_new_matrix_user $SYNAPSE_URL -c /data/homeserver.yaml --admin --user $ADMIN_USERNAME --password $ADMIN_PASSWORD &> /dev/null
|
||||
do
|
||||
echo 'Retrying creating admin...'
|
||||
done
|
||||
|
@ -32,9 +38,9 @@ set -e
|
|||
|
||||
echo 'Saving admin access token'
|
||||
curl --request POST \
|
||||
--url $HOMESERVER/_matrix/client/v3/login \
|
||||
--url $SYNAPSE_URL/_matrix/client/v3/login \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data "{\"type\": \"m.login.password\",\"user\": \"$ADMIN_USERNAME\",\"password\": \"$ADMIN_USERNAME\",\"device_id\": \"DEV\"}" \
|
||||
--data "{\"type\": \"m.login.password\",\"user\": \"$ADMIN_USERNAME\",\"password\": \"$ADMIN_PASSWORD\",\"device_id\": \"DEV\"}" \
|
||||
> src/config/synapse_access_token.json 2> /dev/null
|
||||
|
||||
echo 'Removing log files'
|
||||
|
|
|
@ -3,7 +3,7 @@ import { access_token } from '../config/synapse_access_token.json'
|
|||
import log from './logger'
|
||||
import { getAccessToken } from './storage'
|
||||
|
||||
axios.defaults.baseURL = 'http://localhost:8008'
|
||||
axios.defaults.baseURL = process.env.SYNAPSE_URL || 'http://localhost:8008'
|
||||
axios.defaults.headers.common['Authorization'] = `Bearer ${access_token}`
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json'
|
||||
|
||||
|
|
Loading…
Reference in a new issue