Skip to content

Commit

Permalink
Feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
askask committed Nov 13, 2024
1 parent a9406f2 commit 5697e1f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/highmed/numportal/NumPortalApplication.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.highmed.numportal;


import org.highmed.numportal.properties.FeatureProperties;
import org.highmed.numportal.service.atna.AtnaProperties;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand All @@ -12,7 +11,7 @@
@EnableScheduling
@EnableAsync
@SpringBootApplication
@EnableConfigurationProperties({AtnaProperties.class})
@EnableConfigurationProperties({AtnaProperties.class, FeatureProperties.class})
public class NumPortalApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.highmed.numportal.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
@ConfigurationProperties(prefix = "feature")
public class FeatureProperties {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.highmed.numportal.web.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import lombok.AllArgsConstructor;
import org.highmed.numportal.properties.FeatureProperties;
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
@AllArgsConstructor
@RequestMapping(value = "/feature", produces = "application/json")
@SecurityRequirement(name = "security_auth")
public class FeatureController {

FeatureProperties featureProperties;

@GetMapping
@Operation(description = "Get feature flags")
public ResponseEntity<FeatureProperties> getFeatureFlags() {
return ResponseEntity.ok(featureProperties);
}
}
2 changes: 2 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ num:

user-service:
delete-users-cron: 0 0 5 * * *

feature:
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package org.highmed.numportal;

import org.highmed.numportal.listeners.UserCacheInit;
import org.highmed.numportal.properties.FeatureProperties;
import org.highmed.numportal.service.atna.AtnaProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.annotation.EnableAsync;
import org.highmed.numportal.listeners.UserCacheInit;
import org.highmed.numportal.service.atna.AtnaProperties;

@SpringBootApplication
@EnableConfigurationProperties({AtnaProperties.class})
@EnableConfigurationProperties({AtnaProperties.class, FeatureProperties.class})
@EnableAsync
@ComponentScan(excludeFilters = @ComponentScan.Filter(
type = FilterType.ASSIGNABLE_TYPE,
Expand Down

0 comments on commit 5697e1f

Please sign in to comment.