suchorski / springboot-keycloak-server

Embeded Keycloak on Spring Boot Server
Apache License 2.0
28 stars 13 forks source link

Settings don't persist after restart #5

Closed ebremer closed 1 year ago

ebremer commented 1 year ago

I'm trying out your latest build. It starts up fine and appears to operate fine. However, when I activated "Direct access grants" and added another valid redirect, they saved and appeared to work, but after I restarted the program, the two settings changed, reverted back to the default

suchorski commented 1 year ago

I'm trying out your latest build. It starts up fine and appears to operate fine. However, when I activated "Direct access grants" and added another valid redirect, they saved and appeared to work, but after I restarted the program, the two settings changed, reverted back to the default

Hi, thanks for your message.

Are you using the default configuration? If yes, it uses H2 Memory Database. If you want to persist the data, you need to provide another database like MySQL or Postgres, or even change the H2 to store the database on a file instead of memory.

ebremer commented 1 year ago

My application.yml file looks like this but still doesn't persist:

spring:
  h2:
    console:
      enabled: true
      path: /h2
  datasource:
    username: sa
    password:
    url: jdbc:h2:file:./data/keycloak;DB_CLOSE_ON_EXIT=FALSE
    driver-class-name: org.h2.Driver
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    hibernate:
      ddl-auto: update

keycloak:
  server:
    context-path: /auth
    username: admin
    password: admin
    context-redirect: true

Did I miss something?

ebremer commented 1 year ago

I modified keycloak-server.json with the same URL and it persists now. Is application.yml ignored?

suchorski commented 1 year ago

The spring boot uses the uma file and the keycloak uses the json file. You need to configure both or use command line argument