File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
src/main/java/spring/memewikibe/config Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 22
33import io .swagger .v3 .oas .models .OpenAPI ;
44import io .swagger .v3 .oas .models .info .Info ;
5+ import io .swagger .v3 .oas .models .servers .Server ;
6+ import org .springframework .beans .factory .annotation .Value ;
57import org .springframework .context .annotation .Bean ;
68import org .springframework .context .annotation .Configuration ;
79
10+ import java .util .List ;
11+
812@ Configuration
913public class SwaggerConfig {
1014
15+ @ Value ("${spring.profiles.active:local}" )
16+ private String activeProfile ;
17+
1118 @ Bean
1219 public OpenAPI openAPI () {
13- return new OpenAPI ()
20+ OpenAPI openAPI = new OpenAPI ()
1421 .info (new Info ()
1522 .title ("MemeWikiBE API" )
1623 .version ("v0.0.1" )
1724 .description ("MemeWikiBE API 명세서" ));
25+
26+ if ("prod" .equals (activeProfile )) {
27+ openAPI .servers (List .of (
28+ new Server ()
29+ .url ("https://meme-wiki.net" )
30+ .description ("Production Server (HTTPS)" )
31+ ));
32+ } else {
33+ openAPI .servers (List .of (
34+ new Server ()
35+ .url ("http://localhost:8080" )
36+ .description ("Local Development Server (HTTP)" ),
37+ new Server ()
38+ .url ("https://localhost:8080" )
39+ .description ("Local Development Server (HTTPS)" )
40+ ));
41+ }
42+
43+ return openAPI ;
1844 }
1945
2046}
You can’t perform that action at this time.
0 commit comments