Skip to content

Commit 5f9758b

Browse files
🔧 chore(config): allow to disable PaidCommandInterceptor
1 parent b3e52ce commit 5f9758b

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

generated-requests.http

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
### BuildDwelling
22
@gameId = scenario-1
3+
@playerId = player-1
34
@dwellingId = dwelling-1
5+
6+
### BuildDwelling
47
PUT http://localhost:8080/games/{{gameId}}/dwellings/{{dwellingId}}
58
Content-Type: application/json
9+
X-Player-Id: {{playerId}}
610

711
{
812
"creatureId": "angel",
@@ -15,6 +19,7 @@ Content-Type: application/json
1519
### IncreaseAvailableCreatures
1620
PUT http://localhost:8080/games/{{gameId}}/dwellings/{{dwellingId}}/available-creatures-increases
1721
Content-Type: application/json
22+
X-Player-Id: {{playerId}}
1823

1924
{
2025
"creatureId": "angel",
@@ -24,6 +29,7 @@ Content-Type: application/json
2429
### RecruitCreature
2530
PUT http://localhost:8080/games/{{gameId}}/dwellings/{{dwellingId}}/creature-recruitments
2631
Content-Type: application/json
32+
X-Player-Id: {{playerId}}
2733

2834
{
2935
"creatureId": "angel",

src/main/java/com/dddheroes/heroesofddd/resourcespool/ResourcePoolConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.dddheroes.heroesofddd.resourcespool.write.ResourcesPool;
66
import com.dddheroes.heroesofddd.resourcespool.write.withdraw.PaidCommandInterceptor;
77
import org.axonframework.modelling.command.Repository;
8+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
89
import org.springframework.context.annotation.Bean;
910
import org.springframework.context.annotation.Configuration;
1011

@@ -13,6 +14,7 @@
1314
@Configuration
1415
class ResourcePoolConfiguration {
1516

17+
@ConditionalOnProperty(value = "application.interceptors.paid-commands.enabled", havingValue = "true")
1618
@Bean
1719
PaidCommandInterceptor paidCommandInterceptor(
1820
Set<CommandCostResolver<?>> commandCostResolvers,

src/main/resources/application.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,16 @@ axon:
4646
sequencing-policy: gameIdSequencingPolicy
4747
application:
4848
maintenance:
49-
enabled: true
49+
enabled: true
50+
interceptors:
51+
paid-commands:
52+
enabled: false
53+
54+
springdoc:
55+
api-docs:
56+
path: /api-docs
57+
swagger-ui:
58+
path: /swagger-ui.html
59+
operationsSorter: method
60+
tagsSorter: alpha
61+
docExpansion: none
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
application:
2+
interceptors:
3+
paid-commands:
4+
enabled: true

0 commit comments

Comments
 (0)