Compare commits

..

10 Commits

7 changed files with 24 additions and 16 deletions

View File

@ -20,7 +20,7 @@ COPY eeg_frontend/openapi.yaml ./
RUN npx openapi-generator-cli generate -i ./openapi.yaml -g typescript-angular -o ./src/app/api
COPY eeg_frontend/ ./
RUN npm run build -- --configuration production
RUN npm run build -- --configuration staging
# ---- Stage 2: Build Spring Boot Backend ----
FROM maven:3.9-eclipse-temurin-21 AS backend-build
@ -65,12 +65,8 @@ USER eeg
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/actuator/health || exit 1
ENTRYPOINT ["java", \
"-XX:+UseContainerSupport", \
"-XX:MaxRAMPercentage=75.0", \
"-Djava.security.egd=file:/dev/./urandom", \
"-jar", "app.jar", \
"--spring.profiles.active=prod"]
"-jar", "app.jar"]

View File

@ -28,4 +28,4 @@ foreach ($f in $Files) {
"`n" | Out-File -Append $OutFile -Encoding UTF8
}
Write-Host "Erfolgreich! Der Kontext für Backend und Frontend wurde in '$OutFile' gespeichert."
Write-Host "Erfolgreich! Der Kontext für Backend und Frontend wurde in '$OutFile' gespeichert.."

View File

@ -30,7 +30,6 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import javax.crypto.spec.SecretKeySpec;
import java.util.Arrays;
import java.util.List;
@Configuration
@EnableWebSecurity
@ -94,7 +93,7 @@ public class SecurityConfig {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Arrays.stream(corsOrigins.split(",")).map(String::trim).toList());
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));
configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type"));
configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type", "X-Access-Token"));
configuration.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);

View File

@ -12,7 +12,7 @@ spring:
jwt:
secret: dev-only-secret-do-not-use-in-production-2025
app:
cors-origins: http://localhost:4200
cors-origins: http://localhost:4200,https://preview.coolify.mueller-dev.com
eda:
simulation:
consent-delay-ms: 3000

View File

@ -48,6 +48,15 @@
],
"outputHashing": "all"
},
"staging": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.staging.ts"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
@ -62,6 +71,9 @@
"production": {
"buildTarget": "eeg_frontend:build:production"
},
"staging": {
"buildTarget": "eeg_frontend:build:staging"
},
"development": {
"buildTarget": "eeg_frontend:build:development"
}

View File

@ -3,14 +3,11 @@ import {HttpInterceptorFn} from '@angular/common/http';
export const jwtInterceptor: HttpInterceptorFn = (req, next) => {
const token = localStorage.getItem('token');
// If a token exists, clone the request and add the Authorization header
if (token) {
const clonedRequest = req.clone({
setHeaders: {
Authorization: `Bearer ${token}`
}
const authReq = req.clone({
headers: req.headers.set('X-Access-Token', token)
});
return next(clonedRequest);
return next(authReq);
}
return next(req);

View File

@ -0,0 +1,4 @@
export const environment = {
production: false,
apiUrl: 'https://preview.coolify.mueller-dev.com'
};