forked from cashapp/backfila
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cashapp#30 in CASH/backfila from yunchi/inject to …
…master * commit 'b893f5bcc3463904c0028ef9b439ceb500a6cebc': Misk explicit config & requireAtInjectOnConstructors()
- Loading branch information
Showing
12 changed files
with
92 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
service/src/main/kotlin/com/squareup/backfila/dashboard/DashboardModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.squareup.backfila.dashboard | ||
|
||
import misk.inject.KAbstractModule | ||
import misk.web.actions.WebActionEntry | ||
import misk.web.WebActionModule | ||
|
||
class DashboardModule : KAbstractModule() { | ||
override fun configure() { | ||
multibind<WebActionEntry>().toInstance(WebActionEntry<GetDashboardAction>()) | ||
install(WebActionModule.create<GetDashboardAction>()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
service/src/main/kotlin/com/squareup/backfila/service/BackfilaConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.squareup.backfila.service | ||
|
||
import com.squareup.skim.config.SkimServiceConfig | ||
import misk.client.HttpClientsConfig | ||
import misk.config.Config | ||
import misk.web.WebConfig | ||
|
||
data class BackfilaConfig( | ||
val web: WebConfig, | ||
val http_clients: HttpClientsConfig | ||
val skim: SkimServiceConfig | ||
) : Config |
16 changes: 0 additions & 16 deletions
16
service/src/main/kotlin/com/squareup/backfila/service/BackfilaModule.kt
This file was deleted.
Oops, something went wrong.
4 changes: 3 additions & 1 deletion
4
service/src/main/kotlin/com/squareup/backfila/service/BackfilaService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package com.squareup.backfila.service | ||
|
||
import com.squareup.skim.ServiceBuilder | ||
import misk.config.ConfigModule | ||
import misk.environment.EnvironmentModule | ||
import misk.inject.KAbstractModule | ||
|
||
fun main(args: Array<String>) { | ||
ServiceBuilder.getMiskApplication(::applicationModules).run(args) | ||
} | ||
|
||
fun applicationModules(serviceBuilder: ServiceBuilder<BackfilaConfig>): List<KAbstractModule> { | ||
return listOf(BackfilaServiceModule()) | ||
return listOf(BackfilaServiceModule(serviceBuilder.env, serviceBuilder.config)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
web: | ||
port: 8080 | ||
idle_timeout: 30000 | ||
skim: | ||
web: | ||
port: 8080 | ||
idle_timeout: 30000 | ||
|
||
http_clients: | ||
endpoints: | ||
web_proxy_action: | ||
url: http://localhost/ | ||
http_clients: | ||
endpoints: | ||
web_proxy_action: | ||
url: http://localhost/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
web: | ||
port: 8080 | ||
idle_timeout: 30000 | ||
ssl: | ||
port: 8443 | ||
mutual_auth: DESIRED | ||
cert_store: | ||
resource: filesystem:/etc/secrets/ssl/certificate_private_key_combo.pem | ||
passphrase: doesntmatter | ||
format: PEM | ||
trust_store: | ||
resource: filesystem:/etc/config/certificate_authority.pem | ||
format: PEM | ||
skim: | ||
web: | ||
port: 8080 | ||
idle_timeout: 30000 | ||
ssl: | ||
port: 8443 | ||
mutual_auth: DESIRED | ||
cert_store: | ||
resource: filesystem:/etc/secrets/ssl/certificate_private_key_combo.pem | ||
passphrase: doesntmatter | ||
format: PEM | ||
trust_store: | ||
resource: filesystem:/etc/config/certificate_authority.pem | ||
format: PEM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
web: | ||
port: 8080 | ||
idle_timeout: 30000 | ||
ssl: | ||
port: 8443 | ||
mutual_auth: DESIRED | ||
cert_store: | ||
resource: filesystem:/etc/secrets/ssl/certificate_private_key_combo.pem | ||
passphrase: doesntmatter | ||
format: PEM | ||
trust_store: | ||
resource: filesystem:/etc/config/certificate_authority.pem | ||
format: PEM | ||
|
||
skim: | ||
web: | ||
port: 8080 | ||
idle_timeout: 30000 | ||
ssl: | ||
port: 8443 | ||
mutual_auth: DESIRED | ||
cert_store: | ||
resource: filesystem:/etc/secrets/ssl/certificate_private_key_combo.pem | ||
passphrase: doesntmatter | ||
format: PEM | ||
trust_store: | ||
resource: filesystem:/etc/config/certificate_authority.pem | ||
format: PEM |
25 changes: 25 additions & 0 deletions
25
service/src/test/kotlin/com/squareup/backfila/InjectorTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.squareup.backfila | ||
|
||
import com.squareup.backfila.service.applicationModules | ||
import com.squareup.skim.ServiceBuilder | ||
import misk.environment.Environment | ||
import org.junit.jupiter.api.Test | ||
|
||
/** Tests if guice bindings are setup properly in all environments. */ | ||
internal class InjectorTest { | ||
@Test fun development() { | ||
test(Environment.DEVELOPMENT) | ||
} | ||
|
||
@Test fun staging() { | ||
test(Environment.STAGING) | ||
} | ||
|
||
@Test fun production() { | ||
test(Environment.PRODUCTION) | ||
} | ||
|
||
private fun test(env : Environment) { | ||
ServiceBuilder.getTestVerifier("backfila", env, ::applicationModules).verify() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters