Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions java/.snyk
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@ ignore:
expires: '2030-01-01T00:00:00.000Z'
SNYK:LIC:MAVEN:JUNIT:JUNIT:EPL-1.0:
- '*':
reason: Use of the library is consistent with commercial use as we are not making changes, only consuming it as part of commercial work.
expires: '2030-01-01T00:00:00.000Z'

SNYK:LIC:MAVEN:ORG.ASPECTJ:ASPECTJRT:EPL-1.0:
- '*':
reason: Use of the library is consistent with commercial use as we are not making changes, only consuming it as part of commercial work.
expires: '2030-01-01T00:00:00.000Z'

SNYK:LIC:MAVEN:ORG.ASPECTJ:ASPECTJWEAVER:EPL-1.0:
- '*':
reason: Use of the library is consistent with commercial use as we are not making changes, only consuming it as part of commercial work.
expires: '2030-01-01T00:00:00.000Z'
127 changes: 80 additions & 47 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@

<properties>
<!-- Stacks versions -->
<!-- Stacks features -->
<aws.profile.name>no-aws</aws.profile.name>
<azure.profile.name>no-azure</azure.profile.name>
<cosmosdb.profile.name>no-cosmosdb</cosmosdb.profile.name>
<dynamodb.profile.name>no-dynamodb</dynamodb.profile.name>

<stacks.core.commons.version>1.0.3</stacks.core.commons.version>
<stacks.core.api.version>1.0.2.2-RELEASE</stacks.core.api.version>
<stacks.azure.cosmos.version>1.0.0</stacks.azure.cosmos.version>
<stacks.core.api.version>1.0.3.2-RELEASE</stacks.core.api.version>
<stacks.azure.cosmos.version>2.0.0</stacks.azure.cosmos.version>
<stacks.core.cqrs.version>1.0.0</stacks.core.cqrs.version>

<java.version>11</java.version>
Expand All @@ -31,10 +37,9 @@
<applicationinsights.version>2.6.3</applicationinsights.version>
<cosmosdb.version>3.6.0</cosmosdb.version>
<azure.springboot.version>3.6.0</azure.springboot.version>
<azure.messaging-servicebus.version>7.3.0</azure.messaging-servicebus.version>
<jackson.version>2.12.3</jackson.version>
<mockito.version>3.11.2</mockito.version>
<lombok.version>1.18.20</lombok.version>
<lombok.version>1.18.24</lombok.version>
<hamcrest.version>2.2</hamcrest.version>
<pitest.version>1.6.7</pitest.version>
<jacoco.version>0.8.7</jacoco.version>
Expand All @@ -56,14 +61,6 @@
<spotbugs.version>4.5.2</spotbugs.version>
<exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>

<!-- Set 'pact.broker.url' and 'pact.broker.token' -->
<!-- <pact.broker.url></pact.broker.url>-->
<!-- <pact.broker.token></pact.broker.token>-->
<!-- <pact.api.name>JavaMenuAPI</pact.api.name>-->
<!-- <pact.api.protocol>http</pact.api.protocol>-->
<!-- <pact.api.host>localhost</pact.api.host>-->
<!-- <pact.api.port>9000</pact.api.port>-->
<!-- <pact.version>3.5.24</pact.version>-->
<pact.provider.spring.version>4.0.10</pact.provider.spring.version>
<pact.consumer.version>4.3.2</pact.consumer.version>

Expand Down Expand Up @@ -94,11 +91,7 @@
<artifactId>stacks-core-commons</artifactId>
<version>${stacks.core.commons.version}</version>
</dependency>
<dependency>
<groupId>com.amido.stacks.modules</groupId>
<artifactId>stacks-azure-cosmos</artifactId>
<version>${stacks.azure.cosmos.version}</version>
</dependency>

<dependency>
<groupId>com.amido.stacks.modules</groupId>
<artifactId>stacks-core-api</artifactId>
Expand Down Expand Up @@ -252,36 +245,6 @@
</executions>
</plugin>

<!-- <plugin>-->
<!-- <groupId>au.com.dius.pact.provider</groupId>-->
<!-- <artifactId>maven</artifactId>-->
<!-- <version>4.2.7</version>-->
<!-- <configuration>-->
<!-- <pactBrokerUrl>${pact.broker.url}</pactBrokerUrl>-->
<!-- <pactBrokerToken>${pact.broker.token}</pactBrokerToken>-->
<!-- <systemPropertyVariables>-->
<!-- <pact.verifier.publishResults>true</pact.verifier.publishResults>-->
<!-- </systemPropertyVariables>-->

<!-- <serviceProviders>-->
<!-- <serviceProvider>-->
<!-- <name>${pact.api.name}</name>-->
<!-- <protocol>${pact.api.protocol}</protocol>-->
<!-- <host>${pact.api.host}</host>-->
<!-- <port>${pact.api.port}</port>-->
<!-- </serviceProvider>-->
<!-- </serviceProviders>-->

<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>integration-test</phase>-->
<!-- <goals>-->
<!-- <goal>verify</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->

<plugin>
<groupId>com.coveo</groupId>
Expand Down Expand Up @@ -378,6 +341,76 @@
</build>

<profiles>
<!-- START FEATURE PROFILES -->
<profile>
<id>aws</id>
<activation>
<file>
<exists>.</exists>
</file>
</activation>
<properties>
<aws.profile.name>aws</aws.profile.name>
</properties>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.9</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.9</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>

<profile>
<id>azure</id>
<activation>
<file>
<exists>.</exists>
</file>
</activation>
<properties>
<azure.profile.name>azure</azure.profile.name>
</properties>
<dependencies>
</dependencies>
</profile>

<profile>
<id>cosmosdb</id>
<activation>
<file>
<exists>.</exists>
</file>
</activation>
<properties>
<cosmosdb.profile.name>cosmosdb</cosmosdb.profile.name>
</properties>
<dependencies>
<dependency>
<groupId>com.amido.stacks.modules</groupId>
<artifactId>stacks-azure-cosmos</artifactId>
<version>${stacks.azure.cosmos.version}</version>
</dependency>
</dependencies>
</profile>

<profile>
<id>dynamodb</id>
<properties>
<dynamodb.profile.name>dynamodb</dynamodb.profile.name>
</properties>
<dependencies>
</dependencies>
</profile>

<!-- END FEATURE PROFILES -->

<profile>
<id>owasp-dependency-check</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.amido.stacks.workloads.menu.api.v1;

import com.amido.stacks.workloads.menu.service.v1.SecretsService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(
path = "/v1/secrets",
produces = MediaType.APPLICATION_JSON_VALUE + "; charset=utf-8")
@RequiredArgsConstructor
public class SecretsController {

private final SecretsService secretsService;

@GetMapping
public ResponseEntity<String> getSecrets() {

return ResponseEntity.ok(secretsService.getSecrets());
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.amido.stacks.workloads.menu.repository;

import com.amido.stacks.cosmosdb.repository.StacksCosmosRepository;
import com.amido.stacks.workloads.menu.domain.Menu;
import com.azure.spring.data.cosmos.repository.CosmosRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

@Repository
public interface MenuRepository extends CosmosRepository<Menu, String> {
public interface MenuRepository extends StacksCosmosRepository<Menu> {

@Override
Menu save(Menu menu);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.amido.stacks.workloads.menu.service.v1;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class SecretsService {

@Value(value = "${stacks-secret-1:secret-not-available}")
private String secret1;

@Value(value = "${stacks-secret-2:secret-not-available}")
private String secret2;

@Value(value = "${stacks-secret-3:secret-not-available}")
private String secret3;

@Value(value = "${stacks-secret-4:secret-not-available}")
private String secret4;

public String getSecrets() {

log.info("Getting some secrets...");

return showSecrets();
}

private String showSecrets() {
return "Secrets -> " + secret1 + ", " + secret2 + ", " + secret3 + ", " + secret4;
}
}
10 changes: 10 additions & 0 deletions java/src/main/resources/application-aws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
aws:
xray:
enabled: ${AWS_XRAY_ENABLED:false}
secretsmanager:
enabled: ${AWS_SECRETS_ENABLED:false}

# AWS Secrets Manager imports
spring.config.import:
- optional:aws-secretsmanager:/stacks-secret/example-1/
- optional:aws-secretsmanager:/stacks-secret/example-2/
10 changes: 10 additions & 0 deletions java/src/main/resources/application-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
azure:
application-insights:
instrumentation-key: xxxxxx
enabled: false
keyvault:
enabled: false
uri: https://amido-stacks-tmp.vault.azure.net/
client-id: xxxxxx
client-key: xxxxxx
tenant-id: xxxxxx
5 changes: 5 additions & 0 deletions java/src/main/resources/application-cosmosdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
azure:
cosmos:
uri: https://localhost:8081
database: Stacks
key: ${COSMOSDB_KEY}
Empty file.
22 changes: 7 additions & 15 deletions java/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
spring:
profiles:
include:
- "@aws.profile.name@"
- "@azure.profile.name@"
- "@cosmosdb.profile.name@"
- "@dynamodb.profile.name@"

application:
name: stacks-api-cqrs
data:
Expand Down Expand Up @@ -31,18 +38,3 @@ springdoc:
enabled: true
enabled: true
path: /swagger/oas-json

azure:
cosmos:
uri: https://localhost:8081
database: Stacks
key: ${COSMOSDB_KEY}
application-insights:
instrumentation-key: xxxxxx
enabled: false
keyvault:
enabled: false
uri: https://amido-stacks-tmp.vault.azure.net/
client-id: xxxxxx
client-key: xxxxxx
tenant-id: xxxxxx
10 changes: 10 additions & 0 deletions java/src/main/resources/local/application-aws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
aws:
xray:
enabled: ${AWS_XRAY_ENABLED:false}
secretsmanager:
enabled: ${AWS_SECRETS_ENABLED:false}

# AWS Secrets Manager imports
spring.config.import:
- optional:aws-secretsmanager:/stacks-secret/example-1/
- optional:aws-secretsmanager:/stacks-secret/example-2/
10 changes: 10 additions & 0 deletions java/src/main/resources/local/application-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
azure:
application-insights:
instrumentation-key: xxxxxx
enabled: false
keyvault:
enabled: false
uri: https://amido-stacks-tmp.vault.azure.net/
client-id: xxxxxx
client-key: xxxxxx
tenant-id: xxxxxx
5 changes: 5 additions & 0 deletions java/src/main/resources/local/application-cosmodb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
azure:
cosmos:
uri: https://localhost:8081
database: Stacks
key: ${COSMOSDB_KEY}
Empty file.
22 changes: 7 additions & 15 deletions java/src/main/resources/local/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
spring:
profiles:
include:
- aws
- azure
- cosmodb
- servicebus

application:
name: stacks-api-cqrs
data:
Expand Down Expand Up @@ -31,18 +38,3 @@ springdoc:
enabled: true
enabled: true
path: /swagger/oas-json

azure:
cosmos:
uri: http://192.168.50.169:8081/
database: Stacks
key: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
application-insights:
instrumentation-key: xxxxxx
enabled: false
keyvault:
enabled: false
uri: https://amido-stacks-tmp.vault.azure.net/
client-id: xxxxxx
client-key: xxxxxx
tenant-id: xxxxxx
Loading