diff --git a/mx-tester.yml b/mx-tester.yml index 46a0189..186d34b 100644 --- a/mx-tester.yml +++ b/mx-tester.yml @@ -2,6 +2,11 @@ name: mjolnir up: before: + - docker run --rm --network $MX_TEST_NETWORK_NAME --name mjolnir-test-postgres --domainname mjolnir-test-postgres -e POSTGRES_PASSWORD=mjolnir-test -e POSTGRES_USER=mjolnir-tester -e POSTGRES_DB=mjolnir-test-db -d -p 127.0.0.1:8082:5432 postgres + # Wait until postgresql is ready + - until psql postgres://mjolnir-tester:mjolnir-test@localhost:8082/mjolnir-test-db -c ""; do echo "Waiting for psql..."; sleep 1s; done + # Make table in postgres + - psql postgres://mjolnir-tester:mjolnir-test@localhost:8082/mjolnir-test-db -c "CREATE TABLE mjolnir (local_part VARCHAR(255), owner VARCHAR(255), management_room TEXT)" # Launch the reverse proxy, listening for connections *only* on the local host. - docker run --rm --network host --name mjolnir-test-reverse-proxy -p 127.0.0.1:8081:80 -v $MX_TEST_CWD/test/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx - cp mjolnir-registration.yaml $MX_TEST_SYNAPSE_DIR/data/ @@ -15,6 +20,7 @@ run: down: finally: + - docker stop mjolnir-test-postgres || true - docker stop mjolnir-test-reverse-proxy || true modules: diff --git a/src/appservice/AppService.ts b/src/appservice/AppService.ts index 45b7a8e..492d20f 100644 --- a/src/appservice/AppService.ts +++ b/src/appservice/AppService.ts @@ -32,7 +32,7 @@ export class MjolnirAppService { public readonly mjolnirManager: MjolnirManager = new MjolnirManager(); public constructor() { - this.dataStore = new PgDataStore("foo bar baz"); + this.dataStore = new PgDataStore("postgres://mjolnir-tester:mjolnir-test@localhost:8082/mjolnir-test-db"); new Api("http://localhost:8081", this).start(9001); this.bridge = new Bridge({ homeserverUrl: "http://localhost:8081",