-
Notifications
You must be signed in to change notification settings - Fork 1
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 #33 from crowdproj/wip-4
cleanup: remove AppMode, AppStub, etc
- Loading branch information
Showing
44 changed files
with
152 additions
and
1,413 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
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,17 +1,24 @@ | ||
package com.gitlab.sszuev.flashcards | ||
|
||
import com.gitlab.sszuev.flashcards.config.RunConfig | ||
import com.gitlab.sszuev.flashcards.dbmem.MemDbCardRepository | ||
import com.gitlab.sszuev.flashcards.dbmem.MemDbDictionaryRepository | ||
import com.gitlab.sszuev.flashcards.dbpg.PgDbCardRepository | ||
import com.gitlab.sszuev.flashcards.dbpg.PgDbDictionaryRepository | ||
import com.gitlab.sszuev.flashcards.speaker.createDirectTTSResourceRepository | ||
import com.gitlab.sszuev.flashcards.speaker.rabbitmq.RMQTTSResourceRepository | ||
|
||
fun appRepositories() = AppRepositories( | ||
prodTTSClientRepository = RMQTTSResourceRepository(), | ||
testTTSClientRepository = createDirectTTSResourceRepository(), | ||
prodCardRepository = PgDbCardRepository(), | ||
testCardRepository = MemDbCardRepository(), | ||
prodDictionaryRepository = PgDbDictionaryRepository(), | ||
testDictionaryRepository = MemDbDictionaryRepository(), | ||
) | ||
fun appRepositories(config: RunConfig) = if (config.mode == RunConfig.Mode.TEST) { | ||
AppRepositories( | ||
cardRepository = MemDbCardRepository(), | ||
dictionaryRepository = MemDbDictionaryRepository(), | ||
ttsClientRepository = createDirectTTSResourceRepository(), | ||
) | ||
} else { | ||
AppRepositories( | ||
PgDbCardRepository(), | ||
dictionaryRepository = | ||
PgDbDictionaryRepository(), | ||
ttsClientRepository = RMQTTSResourceRepository(), | ||
) | ||
} |
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,19 +1,18 @@ | ||
package com.gitlab.sszuev.flashcards.config | ||
|
||
import com.gitlab.sszuev.flashcards.model.common.AppMode | ||
import io.ktor.server.config.ApplicationConfig | ||
|
||
data class RunConfig( | ||
val auth: String, | ||
val mode: AppMode, | ||
val mode: Mode, | ||
) { | ||
|
||
constructor(config: ApplicationConfig) : this( | ||
auth = config.property("run-config.debug-auth").getString(), | ||
mode = AppMode.valueOf(config.property("run-config.mode").getString().uppercase()), | ||
mode = Mode.valueOf(config.property("run-config.mode").getString().uppercase()), | ||
) | ||
|
||
fun modeString(): String { | ||
return mode.name.lowercase() | ||
enum class Mode { | ||
PROD, TEST | ||
} | ||
} |
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
Oops, something went wrong.