-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(config): added better configuration
- Loading branch information
1 parent
1d017b5
commit 9748e94
Showing
15 changed files
with
94 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/dev/cloudeko/zenei/domain/feature/impl/VerifyMagicLinkImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/main/java/dev/cloudeko/zenei/exception/UnauthorizedExceptionHandler.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package dev.cloudeko.zenei.infrastructure.config; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import lombok.Getter; | ||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
@Getter | ||
@ApplicationScoped | ||
public class ApplicationConfig { | ||
|
||
@ConfigProperty(name = "zenei.mailer.auto-confirm", defaultValue = "false") | ||
Boolean autoConfirm; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/dev/cloudeko/zenei/infrastructure/config/ConfigFallbackInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package dev.cloudeko.zenei.infrastructure.config; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
import io.smallrye.config.FallbackConfigSourceInterceptor; | ||
import jakarta.annotation.Priority; | ||
|
||
import java.util.Map; | ||
|
||
@Priority(150) | ||
@RegisterForReflection | ||
public class ConfigFallbackInterceptor extends FallbackConfigSourceInterceptor { | ||
|
||
public static final Map<String, String> MAPPING = Map.ofEntries( | ||
Map.entry("quarkus.datasource.db-kind", "zenei.database.db-kind"), | ||
Map.entry("quarkus.datasource.username", "zenei.database.username"), | ||
Map.entry("quarkus.datasource.password", "zenei.database.password"), | ||
Map.entry("quarkus.datasource.jdbc.url", "zenei.database.url"), | ||
Map.entry("smallrye.jwt.sign.key.location", "zenei.jwt.private.key.location"), | ||
Map.entry("smallrye.jwt.new-token.lifespan", "zenei.jwt.token.lifespan"), | ||
Map.entry("mp.jwt.verify.publickey", "zenei.jwt.private.key"), | ||
Map.entry("mp.jwt.verify.publickey.location", "zenei.jwt.public.key.location"), | ||
Map.entry("mp.jwt.verify.publickey.algorithm", "zenei.jwt.public.key.algorithm"), | ||
Map.entry("mp.jwt.verify.issuer", "zenei.jwt.issuer"), | ||
Map.entry("mp.jwt.verify.audiences", "zenei.jwt.audiences"), | ||
Map.entry("mp.jwt.verify.clock.skew", "zenei.jwt.clock.skew"), | ||
Map.entry("mp.jwt.verify.token.age", "zenei.jwt.token.age") | ||
); | ||
|
||
public ConfigFallbackInterceptor() { | ||
super(name -> MAPPING.getOrDefault(name, name)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
...java/dev/cloudeko/zenei/infrastructure/web/security/AccessTokenSecurityAuthMechanism.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dev.cloudeko.zenei.infrastructure.config.ConfigFallbackInterceptor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
# Application configuration | ||
# Name of the Quarkus application. This can be used in various places, e.g., metrics. | ||
quarkus.application.name=cloudeko-zenei-auth-service | ||
# Path to a custom banner text file to be displayed on application startup. | ||
quarkus.banner.path=zenei_banner.txt | ||
|
||
# Database configuration | ||
quarkus.datasource.db-kind=postgresql | ||
# JDBC driver class for the database connection. | ||
quarkus.datasource.jdbc.driver=org.postgresql.Driver | ||
|
||
# Hibernate ORM strategy for database schema generation. | ||
# 'update' will attempt to update the existing schema to match the entities. | ||
quarkus.hibernate-orm.database.generation=update | ||
# In 'dev' profile, drop and recreate the database schema on each startup. | ||
%dev.quarkus.hibernate-orm.database.generation=drop-and-create | ||
# In 'test' profile, drop and recreate the database schema on each startup. | ||
%test.quarkus.hibernate-orm.database.generation=drop-and-create | ||
# JWT configuration | ||
smallrye.jwt.sign.key.location=dev-private-key.pem | ||
mp.jwt.verify.publickey.location=dev-public-key.pem | ||
mp.jwt.verify.issuer=https://example.com/issuer | ||
|
||
# Mail configuration | ||
# Use a mock mailer for development, not sending actual emails. | ||
quarkus.mailer.mock=true | ||
%prod.quarkus.mailer.mock=false | ||
# In 'prod' profile, disable the mock mailer and send real emails. | ||
%prod.quarkus.mailer.mock=false | ||
|
||
# Zenei Configuration | ||
# Type of database used by the Zenei application. | ||
zenei.database.db-kind=postgresql | ||
# Location of the private key file for JWT signing. | ||
zenei.jwt.private.key.location=dev-private-key.pem | ||
# Location of the public key file for JWT verification. | ||
zenei.jwt.public.key.location=dev-public-key.pem | ||
# Issuer identifier to be included in generated JWTs. | ||
zenei.jwt.issuer=https://example.com/issuer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
______ ______ __ __ ______ __ | ||
/\___ \ /\ ___\ /\ "-.\ \ /\ ___\ /\ \ | ||
\/_/ /__ \ \ __\ \ \ \-. \ \ \ __\ \ \ \ | ||
/\_____\ \ \_____\ \ \_\\"\_\ \ \_____\ \ \_\ | ||
\/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_/ |