diff --git a/pom.xml b/pom.xml index 5b8f57f..12865ae 100644 --- a/pom.xml +++ b/pom.xml @@ -1,97 +1,104 @@ - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 4.0.0 - - - com.CSO2 - user-identity-service - 0.0.1-SNAPSHOT - user-identity-service - user-identity-service of CSO2 - - - - - - - - - - - - - - - 17 - 1.18.42 - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-validation - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-devtools - true - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - - org.postgresql - postgresql - runtime - - - org.projectlombok - lombok - ${lombok.version} - true - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.security - spring-security-test - test - - - - io.jsonwebtoken - jjwt-api - 0.11.5 - - - io.jsonwebtoken - jjwt-impl - 0.11.5 - runtime - - - io.jsonwebtoken - jjwt-jackson - 0.11.5 - runtime - + + org.springframework.boot + spring-boot-starter-parent + 3.2.5 + + + + com.CSO2 + user-identity-service + 0.0.1-SNAPSHOT + user-identity-service + user-identity-service of CSO2 + + + 17 + 1.18.42 + 2023.0.0 + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + org.springframework.cloud + spring-cloud-starter-vault-config + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-devtools + true + + + org.postgresql + postgresql + runtime + + + org.projectlombok + lombok + ${lombok.version} + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + io.jsonwebtoken + jjwt-api + 0.11.5 + + + io.jsonwebtoken + jjwt-impl + 0.11.5 + runtime + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + runtime + org.springframework.boot spring-boot-starter-actuator @@ -99,38 +106,36 @@ org.springdoc springdoc-openapi-starter-webmvc-ui - 2.8.4 - + 2.5.0 - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - org.projectlombok - lombok - ${lombok.version} - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.projectlombok + lombok + ${lombok.version} + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index f73a272..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -spring.application.name=user-identity-service -server.port=${SERVER_PORT:8081} - -# PostgreSQL Configuration (override via env vars in production) -spring.datasource.url=${DATABASE_URL:jdbc:postgresql://localhost:5432/CSO2_user_identity_service} -spring.datasource.username=${DATABASE_USERNAME:cso2} -spring.datasource.password=${DATABASE_PASSWORD:password123} -spring.jpa.hibernate.ddl-auto=update - -# JWT Configuration (MUST override JWT_SECRET in production!) -jwt.secret=${JWT_SECRET:VerySecretJwtKeyForLocalDevelopmentChangeThis} -jwt.expiration=${JWT_EXPIRATION:86400000} -jwt.refresh-expiration=${JWT_REFRESH_EXPIRATION:604800000} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..baafc53 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,51 @@ +# --- Spring Configuration for Vault and Database --- +spring: + # 1. New Config Import Structure: Tells Spring to load properties from Vault first. + config: + import: "optional:vault://" + + # 2. Vault Configuration (Using static values prevents the StackOverflowError) + cloud: + vault: + enabled: true + uri: http://localhost:8200 + token: my-root-token + kv: + enabled: true + backend: kv + # This MUST match the secret path you created in the CLI: kv/data/cs02-app + default-context: cs02-app + authentication: TOKEN + + # 3. Application Name + application: + name: cs02-app + + # 4. Data Source Configuration + datasource: + # URL is static. 'localhost' is correct. + url: jdbc:postgresql://localhost:5432/CSO2_user_identity_service + + # 5. The Secrets! These placeholders are filled by Vault at runtime. + username: ${db_username} + password: ${db_password} + + # 6. JPA/Hibernate Configuration + jpa: + hibernate: + ddl-auto: update + properties: + hibernate: + # **NEW LINE ADDED: This explicitly sets the dialect, helping initialization timing** + dialect: org.hibernate.dialect.PostgreSQLDialect + +# --- Other Application Properties --- +server: + port: 8081 + +# --- JWT Configuration --- +jwt: + secret: ${JWT_SECRET:VerySecretJwtKeyForLocalDevelopmentChangeThis} + expiration: ${JWT_EXPIRATION:86400000} + # Make sure this line exists and is indented correctly: + refresh-expiration: ${JWT_REFRESH_EXPIRATION:604800000} \ No newline at end of file