Skip to content

Commit

Permalink
Actually use port settings in config
Browse files Browse the repository at this point in the history
  • Loading branch information
kesslern committed Aug 8, 2019
1 parent 6d69652 commit 7d2e3ad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A pastebin designed for personal self-hosting.
## Running

Download a release from [here](https://github.com/kesslern/gluecan/releases). After extraction, configure `gluecan-config.yml` and run `bin/gluecan`.
this.port = yamlMapping.string("port")!!.toInt()

## Configuration

Expand All @@ -23,6 +24,7 @@ GlueCan's pastes are always publicly viewable, but creation and deletion of past
| Configuration Key | Description |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| port | The port to listen on. |
| sslPort | The port to listen on for SSL, if used. |
| public | If true, the admin interface and ability to create/delete pastes is password protected. Pastes are always publicly viewable. |
| admin_pass | The password if running in private mode. Unused in public mode. |
| database | Database path/filename to use. |
Expand Down
1 change: 1 addition & 0 deletions gluecan-backend/gluecan-config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
port: 8080
sslPort: 8443

# No password required to add/delete if public
public: false
Expand Down
2 changes: 2 additions & 0 deletions gluecan-backend/src/main/kotlin/config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object Config {
val keystorePath: String?
val keystorePassword: String?
val port: Int
val sslPort: Int


init {
Expand All @@ -22,6 +23,7 @@ object Config {
this.adminPass = yamlMapping.string("adminPass")
this.database = "jdbc:sqlite:${yamlMapping.string("database")}"
this.port = yamlMapping.string("port")!!.toInt()
this.sslPort = yamlMapping.string("sslPort")!!.toInt()
this.public = yamlMapping.string("public")!!.toBoolean()

val keystore = yamlMapping.yamlMapping("keystore")
Expand Down
4 changes: 2 additions & 2 deletions gluecan-backend/src/main/kotlin/server-config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ fun JavalinConfig.gluecanConfig() {
val sslConnector = if (Config.keystorePath != null) {
log.info("Enabling SSL")
val sslConnector = ServerConnector(server, getSslContextFactory())
sslConnector.setPort(8443)
sslConnector.port = Config.sslPort
sslConnector
} else null

val connector = ServerConnector(server)
connector.port = 8080
connector.port = Config.port

if (sslConnector != null) {
server.connectors = arrayOf(sslConnector, connector)
Expand Down

0 comments on commit 7d2e3ad

Please sign in to comment.