From a03da9dc740dca9e20538810f197ec9e5e9e6daa Mon Sep 17 00:00:00 2001 From: Eneko Date: Thu, 25 Mar 2021 19:49:20 +0100 Subject: [PATCH] Setup matrix-spring-boot --- .gitignore | 2 + build.gradle.kts | 3 ++ src/main/resources/application.properties | 7 --- src/main/resources/application.yml | 55 +++++++++++++++++++++++ 4 files changed, 60 insertions(+), 7 deletions(-) delete mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/application.yml diff --git a/.gitignore b/.gitignore index a3377b4..fedb106 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ okupamicoche.mv.db +matrix.mv.db +matrix.trace.db HELP.md .gradle diff --git a/build.gradle.kts b/build.gradle.kts index 4422625..4359fc9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,8 +24,11 @@ dependencies { implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + // https://mvnrepository.com/artifact/net.folivo/matrix-spring-boot-bot + implementation (group = "net.folivo", name = "matrix-spring-boot-bot", version = "0.4.5") developmentOnly("org.springframework.boot:spring-boot-devtools") runtimeOnly("com.h2database:h2") + runtimeOnly("io.r2dbc:r2dbc-h2") providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") testImplementation("org.springframework.boot:spring-boot-starter-test") } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index b17162e..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8080/auth/realms/okupamicoche -#spring.security.oauth2.resourceserver.jwt.issuer-uri=https://auth.fosil.eu/auth/realms/test -spring.jpa.hibernate.ddl-auto=update -spring.datasource.url=jdbc:h2:file:./okupamicoche;DB_CLOSE_ON_EXIT=FALSE;AUTO_RECONNECT=TRUE -spring.datasource.driver-class-name=org.h2.Driver -spring.jpa.database-platform=org.hibernate.dialect.H2Dialect -server.port=8081 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..baf1905 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,55 @@ +server: + port: 8081 +spring: + datasource: + driver-class-name: org.h2.Driver + url: jdbc:h2:file:./okupamicoche;DB_CLOSE_ON_EXIT=FALSE;AUTO_RECONNECT=TRUE + jpa: + database-platform: org.hibernate.dialect.H2Dialect + hibernate: + ddl-auto: update + security: + oauth2: + resourceserver: + jwt: + issuer-uri: http://localhost:8080/auth/realms/okupamicoche + +matrix: + bot: + # The domain-part of matrix-ids. E. g. example.org when your userIds look like @unicorn:example.org + serverName: synapse + # The localpart (username) of the user associated with the application service + # or just the username of your bot. + username: test + # (optional) Display name for the bot user. + displayname: Okupa mi coche + # (optional) The mode you want to use to create a bot. Default is CLIENT. The other is APPSERVICE. + mode: CLIENT + # (optional) Configure how users managed by your bot do automatically join rooms. + # ENABLED allows automatic joins to every invited room. + # DISABLED disables this feature. + # Default is RESTRICTED, which means, that only automatic joins to serverName are allowed. + autoJoin: DISABLED + # (optional) Configure if ALL membership changes should be tracked/saved with help of MatrixAppserviceRoomService + # or only membership changes of users, which are MANAGED by the bridge. Default is ALL (no tracking/saving). + trackMembership: ALL + # Connection settings to the database (only r2dbc drivers are supported) + migration: + url: jdbc:h2:file:./matrix + username: sa + password: + # Connection setting to the database for migration purpose only (only jdbc drivers ar supported) + database: + url: r2dbc:h2:file:///./matrix + username: sa + password: + client: + homeServer: + # The hostname of your Homeserver. + hostname: synapse + # (optional) The port of your Homeserver. Default is 443. + port: 8008 + # (optional) Use http or https. Default is true (so uses https). + secure: false + # The token to authenticate against the Homeserver. + token: MDAxNWxvY2F0aW9uIHN5bmFwc2UKMDAxM2lkZW50aWZpZXIga2V5CjAwMTBjaWQgZ2VuID0gMQowMDIwY2lkIHVzZXJfaWQgPSBAdGVzdDpzeW5hcHNlCjAwMTZjaWQgdHlwZSA9IGFjY2VzcwowMDIxY2lkIG5vbmNlID0gLktxS1E0elVTSi10LDJQTwowMDJmc2lnbmF0dXJlIJ3TmHyJSZw9H0AsCgn3mK4MUhIfRljU-rwxHm5e1N46Cg \ No newline at end of file