Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
Inovasi Daerah Master
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ghitha Dinan
Inovasi Daerah Master
Commits
790e31b3
Commit
790e31b3
authored
Jan 05, 2022
by
Ghitha Dinan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add swagger config
parent
e9d4fa9b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
118 additions
and
16 deletions
+118
-16
pom.xml
pom.xml
+13
-0
SpringWebConfig.kt
...ngkuriang/inovasi/daerah/master/config/SpringWebConfig.kt
+20
-2
SwaggerConfig.kt
...sangkuriang/inovasi/daerah/master/config/SwaggerConfig.kt
+67
-0
FileConstant.kt
...angkuriang/inovasi/daerah/master/constant/FileConstant.kt
+2
-2
SecurityConstant.kt
...uriang/inovasi/daerah/master/constant/SecurityConstant.kt
+2
-2
UrlConstant.kt
...sangkuriang/inovasi/daerah/master/constant/UrlConstant.kt
+2
-2
application.properties
src/main/resources/application.properties
+10
-6
logback.xml
src/main/resources/logback.xml
+2
-2
No files found.
pom.xml
View file @
790e31b3
...
@@ -97,6 +97,19 @@
...
@@ -97,6 +97,19 @@
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
3.0.0
</version>
</dependency>
<dependency>
<groupId>
org.springdoc
</groupId>
<artifactId>
springdoc-openapi-ui
</artifactId>
<version>
1.2.32
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/config/SpringWebConfig.kt
View file @
790e31b3
...
@@ -6,6 +6,8 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean
...
@@ -6,6 +6,8 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean
import
org.springframework.context.annotation.Bean
import
org.springframework.context.annotation.Bean
import
org.springframework.context.annotation.Configuration
import
org.springframework.context.annotation.Configuration
import
org.springframework.web.servlet.config.annotation.CorsRegistry
import
org.springframework.web.servlet.config.annotation.CorsRegistry
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
import
org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
...
@@ -26,8 +28,8 @@ class SpringWebConfig : WebMvcConfigurer {
...
@@ -26,8 +28,8 @@ class SpringWebConfig : WebMvcConfigurer {
FilterRegistrationBean
<
TokenInterceptor
>()
FilterRegistrationBean
<
TokenInterceptor
>()
AUDIENCE_FILTER_PATH
.
forEach
{
AUDIENCE_FILTER_PATH
.
forEach
{
it
.
value
.
forEach
{
it
.
value
.
forEach
{
it2
->
registrationBean
.
addUrlPatterns
(
it
)
registrationBean
.
addUrlPatterns
(
it
2
)
}
}
}
}
...
@@ -35,4 +37,20 @@ class SpringWebConfig : WebMvcConfigurer {
...
@@ -35,4 +37,20 @@ class SpringWebConfig : WebMvcConfigurer {
registrationBean
.
order
=
1
registrationBean
.
order
=
1
return
registrationBean
return
registrationBean
}
}
override
fun
addViewControllers
(
registry
:
ViewControllerRegistry
)
{
registry
.
addRedirectViewController
(
"/v2/api-docs"
,
"/v2/api-docs"
)
registry
.
addRedirectViewController
(
"/swagger-resources/configuration/ui"
,
"/swagger-resources/configuration/ui"
)
registry
.
addRedirectViewController
(
"/swagger-resources/configuration/security"
,
"/swagger-resources/configuration/security"
)
registry
.
addRedirectViewController
(
"/swagger-resources"
,
"/swagger-resources"
)
}
override
fun
addResourceHandlers
(
registry
:
ResourceHandlerRegistry
)
{
registry
.
addResourceHandler
(
"/swagger-ui.html**"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/swagger-ui.html"
)
registry
.
addResourceHandler
(
"/webjars/**"
).
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
)
}
}
}
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/config/SwaggerConfig.kt
0 → 100644
View file @
790e31b3
package
id.co.sangkuriang.inovasi.daerah.master.config
import
org.springframework.beans.factory.annotation.Value
import
org.springframework.context.annotation.Bean
import
org.springframework.context.annotation.Configuration
import
springfox.documentation.builders.PathSelectors
import
springfox.documentation.builders.RequestHandlerSelectors
import
springfox.documentation.service.*
import
springfox.documentation.spi.DocumentationType
import
springfox.documentation.spi.service.contexts.SecurityContext
import
springfox.documentation.spring.web.plugins.Docket
import
springfox.documentation.swagger2.annotations.EnableSwagger2
import
java.util.*
@Suppress
(
"UNCHECKED_CAST"
,
"DEPRECATION"
)
@Configuration
@EnableSwagger2
class
SwaggerConfig
{
@Value
(
"\${swagger.host}"
)
private
val
host
:
String
?
=
null
@Value
(
"\${swagger.protocol}"
)
private
val
protocol
:
String
?
=
null
@Bean
fun
api
():
Docket
?
{
return
Docket
(
DocumentationType
.
SWAGGER_2
)
.
host
(
host
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"id.co.sangkuriang.inovasi.daerah.master.controller"
))
.
paths
(
PathSelectors
.
any
())
.
build
()
.
useDefaultResponseMessages
(
false
)
.
apiInfo
(
apiInfo
())
.
protocols
(
setOf
(
protocol
))
.
securitySchemes
(
listOf
(
apiKey
())
as
List
<
SecurityScheme
>?)
.
securityContexts
(
Collections
.
singletonList
(
securityContext
()))
}
private
fun
apiInfo
():
ApiInfo
{
return
ApiInfo
(
"Inovasi Daerah API - Master"
,
"Api Service for Application Inovasi Daerah Master"
,
"1.0"
,
"Terms of service"
,
Contact
(
"Inovasi Daerah"
,
"https://cms.inovasi-daerah.dev.layanan.go.id"
,
"inovasi-daerah@gmail.com"
),
""
,
""
,
Collections
.
emptyList
()
)
}
private
fun
apiKey
():
ApiKey
{
return
ApiKey
(
"Bearer"
,
"Authorization"
,
"header"
)
}
private
fun
securityContext
():
SecurityContext
?
{
return
SecurityContext
.
builder
().
securityReferences
(
defaultAuth
()).
forPaths
(
PathSelectors
.
regex
(
"/.*"
)).
build
()
}
private
fun
defaultAuth
():
List
<
SecurityReference
?>
{
return
listOf
(
SecurityReference
(
"Bearer"
,
arrayOfNulls
(
0
)))
}
}
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/constant/FileConstant.kt
View file @
790e31b3
...
@@ -2,8 +2,8 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
...
@@ -2,8 +2,8 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
import
java.io.File
import
java.io.File
//
const val ROOT_DIR = "D:\\app-files\\inovasi_daerah_master\\files\\"
const
val
ROOT_DIR
=
"D:\\app-files\\inovasi_daerah_master\\files\\"
const
val
ROOT_DIR
=
"/home/inovasi-daerah/data/files/inovasi_daerah_master/"
//
const val ROOT_DIR = "/home/inovasi-daerah/data/files/inovasi_daerah_master/"
//const val ROOT_DIR = "/home/inovasi-daerah-prod/data/files/inovasi_daerah_master/"
//const val ROOT_DIR = "/home/inovasi-daerah-prod/data/files/inovasi_daerah_master/"
val
UPLOAD_DIR
=
"${ROOT_DIR}uploads${File.separator}"
val
UPLOAD_DIR
=
"${ROOT_DIR}uploads${File.separator}"
...
...
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/constant/SecurityConstant.kt
View file @
790e31b3
...
@@ -3,8 +3,8 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
...
@@ -3,8 +3,8 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
const
val
TOKEN_PREFIX
=
"Bearer "
const
val
TOKEN_PREFIX
=
"Bearer "
const
val
HEADER_STRING
=
"Authorization"
const
val
HEADER_STRING
=
"Authorization"
//const val AUTH_URL = "http://localhost:8081/auth"
//const val AUTH_URL = "http://localhost:8081/auth"
//
const val AUTH_URL = "https://auth.inovasi-daerah.dev.layanan.go.id/auth"
const
val
AUTH_URL
=
"https://auth.inovasi-daerah.dev.layanan.go.id/auth"
const
val
AUTH_URL
=
"http://inovasi-daerah-auth.inovasi-daerah.svc.cluster.local:8081/auth"
//
const val AUTH_URL = "http://inovasi-daerah-auth.inovasi-daerah.svc.cluster.local:8081/auth"
//const val AUTH_URL = "http://inovasi-daerah-auth-prod.inovasi-daerah-prod.svc.cluster.local:8081/auth"
//const val AUTH_URL = "http://inovasi-daerah-auth-prod.inovasi-daerah-prod.svc.cluster.local:8081/auth"
val
USER_ALLOWED_PATH
=
emptyList
<
String
>()
val
USER_ALLOWED_PATH
=
emptyList
<
String
>()
...
...
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/constant/UrlConstant.kt
View file @
790e31b3
...
@@ -2,6 +2,6 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
...
@@ -2,6 +2,6 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
//const val APPLICATION_URL = "http://localhost:8082"
//const val APPLICATION_URL = "http://localhost:8082"
//const val APPLICATION_URL = "https://application.inovasi-daerah.dev.layanan.go.id"
//const val APPLICATION_URL = "https://application.inovasi-daerah.dev.layanan.go.id"
const
val
APPLICATION_URL
=
"http://inovasi-daerah-application.inovasi-daerah.svc.cluster.local:8082"
//
const val APPLICATION_URL = "http://inovasi-daerah-application.inovasi-daerah.svc.cluster.local:8082"
//
const val APPLICATION_URL = "http://inovasi-daerah-application-prod.inovasi-daerah-prod.svc.cluster.local:8082"
const
val
APPLICATION_URL
=
"http://inovasi-daerah-application-prod.inovasi-daerah-prod.svc.cluster.local:8082"
src/main/resources/application.properties
View file @
790e31b3
...
@@ -5,14 +5,14 @@ server.port=8080
...
@@ -5,14 +5,14 @@ server.port=8080
# DATABASE CONFIG
# DATABASE CONFIG
# local
# local
#
spring.datasource.url=jdbc:postgresql://localhost:5432/inovasi_daerah_backup
spring.datasource.url
=
jdbc:postgresql://localhost:5432/inovasi_daerah_backup
#
spring.datasource.username=postgres
spring.datasource.username
=
postgres
#
spring.datasource.password=root
spring.datasource.password
=
root
# dev
# dev
spring.datasource.url
=
jdbc:postgresql://pg.dev.layanan.go.id:5432/inovasi_daerah_db
#
spring.datasource.url=jdbc:postgresql://pg.dev.layanan.go.id:5432/inovasi_daerah_db
spring.datasource.username
=
u_inovasi_daerah
#
spring.datasource.username=u_inovasi_daerah
spring.datasource.password
=
wV9Tnx6S8TmmUYXdgkmN4pzreSD3RE
#
spring.datasource.password=wV9Tnx6S8TmmUYXdgkmN4pzreSD3RE
# prod
# prod
#spring.datasource.url=jdbc:postgresql://pg.prd.layanan.go.id:5432/inovasi_daerah_db
#spring.datasource.url=jdbc:postgresql://pg.prd.layanan.go.id:5432/inovasi_daerah_db
...
@@ -35,3 +35,7 @@ spring.servlet.multipart.max-request-size=500MB
...
@@ -35,3 +35,7 @@ spring.servlet.multipart.max-request-size=500MB
# APP CONFIG
# APP CONFIG
server.max-http-header-size
=
10000KB
server.max-http-header-size
=
10000KB
# Swagger
swagger.host
=
localhost:8080
swagger.protocol
=
http
src/main/resources/logback.xml
View file @
790e31b3
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
<!-- configuration file for LogBack (slf4J implementation)
<!-- configuration file for LogBack (slf4J implementation)
See here for more details: http://gordondickens.com/wordpress/2013/03/27/sawing-through-the-java-loggers/ -->
See here for more details: http://gordondickens.com/wordpress/2013/03/27/sawing-through-the-java-loggers/ -->
<configuration
scan=
"true"
scanPeriod=
"30 seconds"
>
<configuration
scan=
"true"
scanPeriod=
"30 seconds"
>
<!-- <property name="DEV_HOME" value="D://app-files//inovasi_daerah_master//log"/>--
>
<property
name=
"DEV_HOME"
value=
"D://app-files//inovasi_daerah_master//log"
/
>
<property
name=
"DEV_HOME"
value=
"/home/inovasi-daerah/data/log/inovasi_daerah_master"
/
>
<!-- <property name="DEV_HOME" value="/home/inovasi-daerah/data/log/inovasi_daerah_master"/>--
>
<!-- <property name="DEV_HOME" value="/home/inovasi-daerah-prod/data/log/inovasi_daerah_master"/>-->
<!-- <property name="DEV_HOME" value="/home/inovasi-daerah-prod/data/log/inovasi_daerah_master"/>-->
<appender
name=
"ACCESS-LOG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<appender
name=
"ACCESS-LOG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment