parent
6e80b13015
commit
d25e82c42a
6 changed files with 88 additions and 3 deletions
17
k8/configmap.yaml
Normal file
17
k8/configmap.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: silly-game-config
|
||||||
|
namespace: silly-game
|
||||||
|
data:
|
||||||
|
game-config.properties: |
|
||||||
|
spring.application.name=silly-game
|
||||||
|
|
||||||
|
spring.mail.host=mailhog.mailhog.svc.cluster.local
|
||||||
|
spring.mail.port=1025
|
||||||
|
spring.mail.username=
|
||||||
|
spring.mail.password=
|
||||||
|
spring.mail.properties.mail.smtp.auth=false
|
||||||
|
spring.mail.properties.mail.smtp.starttls.enable=false
|
||||||
|
|
||||||
|
cors.allowed-origin=http://silly-game-service.silly-game.svc.cluster.local
|
48
k8/deployment.yaml
Normal file
48
k8/deployment.yaml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: silly-game
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: silly-game-deployment
|
||||||
|
namespace: silly-game
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: silly-game
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: silly-game
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: silly-game
|
||||||
|
image: mygit-silly-game-backend:main
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /config
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: silly-game-config
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: silly-game-service
|
||||||
|
namespace: silly-game
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: silly-game
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8080
|
|
@ -7,7 +7,6 @@ import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin(origins = "http://localhost:4200")
|
|
||||||
@RequestMapping("/game")
|
@RequestMapping("/game")
|
||||||
public class GameController {
|
public class GameController {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api")
|
@RequestMapping("/api")
|
||||||
@CrossOrigin(origins = "http://localhost:4200")
|
|
||||||
public class InviteController {
|
public class InviteController {
|
||||||
|
|
||||||
@PostMapping("/invite")
|
@PostMapping("/invite")
|
||||||
|
|
20
src/main/java/de/telekom/silly_game/WebConfig.java
Normal file
20
src/main/java/de/telekom/silly_game/WebConfig.java
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package de.telekom.silly_game;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Value("${cors.allowed-origin}")
|
||||||
|
private String allowedOrigin;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedOrigins(allowedOrigin)
|
||||||
|
.allowedMethods("*");
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,4 +5,6 @@ spring.mail.port=1025
|
||||||
spring.mail.username=
|
spring.mail.username=
|
||||||
spring.mail.password=
|
spring.mail.password=
|
||||||
spring.mail.properties.mail.smtp.auth=false
|
spring.mail.properties.mail.smtp.auth=false
|
||||||
spring.mail.properties.mail.smtp.starttls.enable=false
|
spring.mail.properties.mail.smtp.starttls.enable=false
|
||||||
|
|
||||||
|
cors.allowed-origin=http://localhost:4200
|
Loading…
Reference in a new issue