File tree 7 files changed +55
-11
lines changed
7 files changed +55
-11
lines changed Original file line number Diff line number Diff line change 4
4
** /build /
5
5
! gradle-wrapper.jar
6
6
gluecan-backend /gluecan
7
+ ** /* .sqlite
Original file line number Diff line number Diff line change @@ -43,5 +43,6 @@ dependencies {
43
43
implementation(" org.jetbrains.exposed:exposed:0.15.1" )
44
44
implementation(" com.fasterxml.jackson.core:jackson-databind:2.9.9" )
45
45
implementation(" commons-lang:commons-lang:2.6" )
46
+ implementation(" com.amihaiemil.web:eo-yaml:2.0.1" )
46
47
runtime(project(" :gluecan-frontend" ))
47
48
}
Original file line number Diff line number Diff line change
1
+ port : 8080
2
+
3
+ # No password required to add/delete if public
4
+ public : false
5
+
6
+ # Password for administration UI if not public
7
+ adminPass : change_me
8
+
9
+ # Database name/path
10
+ database : gluecan.sqlite
11
+
12
+ # Optional keystore for HTTPS
13
+ keystore :
14
+ path : ~
15
+ password : ~
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package us.kesslern
2
+
3
+ import com.amihaiemil.eoyaml.Yaml
4
+ import com.amihaiemil.eoyaml.YamlMapping
5
+ import java.io.File
6
+
7
+ object Config {
8
+ val adminPass: String
9
+ val public: Boolean
10
+ val database: String
11
+ val keystorePath: String?
12
+ val keystorePassword: String?
13
+ val port: Int
14
+
15
+
16
+ init {
17
+ val yamlMapping = Yaml
18
+ .createYamlInput(File (" gluecan-config.yml" ))
19
+ .readYamlMapping()
20
+
21
+
22
+ this .adminPass = yamlMapping.string(" adminPass" )
23
+ this .database = " jdbc:sqlite:${yamlMapping.string(" database" )} "
24
+ this .port = yamlMapping.string(" port" )!! .toInt()
25
+ this .public = yamlMapping.string(" public" )!! .toBoolean()
26
+
27
+ val keystore = yamlMapping.yamlMapping(" keystore" )
28
+ this .keystorePath = keystore.optionalString(" path" )
29
+ this .keystorePassword = keystore.optionalString(" password" )
30
+ }
31
+ }
32
+
33
+ fun YamlMapping.optionalString (key : String ): String? {
34
+ val value = this .string(key)
35
+ return if (value == " ~" ) null else value
36
+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,6 @@ fun main() {
16
16
17
17
app.gluecan()
18
18
19
- app.start(8080 )
19
+ app.start(Config .port )
20
20
}
21
21
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ object Templater {
14
14
.readText()
15
15
.replace(" {{pasteId}}" , paste.id.toString())
16
16
.replace(" {{class}}" , paste.language ? : " " )
17
- .replace(" {{date}}" , paste.date.toString() )
17
+ .replace(" {{date}}" , paste.date)
18
18
.replace(" {{pasteHtml}}" , paste.toHtml())
19
19
20
20
}
You can’t perform that action at this time.
0 commit comments