refactor rename to application.yaml
This commit is contained in:
1 parent
807d466b31
commit
debe6c92c8
2 files changed
+4
-7
No files matched your search
@@ -43,8 +43,8 @@ fun loadConfig(): ConfigResult {
|
|||||||
|
|
||||||
// External files take precedence (production use)
|
// External files take precedence (production use)
|
||||||
val externalLocations = listOf(
|
val externalLocations = listOf(
|
||||||
File(System.getProperty("user.home"), ".anytask/anytask.yaml"),
|
File(System.getProperty("user.home"), ".anytask/application.yaml"),
|
||||||
File("anytask.yaml"),
|
File("application.yaml"),
|
||||||
)
|
)
|
||||||
externalLocations.firstOrNull { it.exists() }?.let { file ->
|
externalLocations.firstOrNull { it.exists() }?.let { file ->
|
||||||
val config = yaml.decodeFromString(serializer, file.readText())
|
val config = yaml.decodeFromString(serializer, file.readText())
|
||||||
@@ -53,7 +53,7 @@ fun loadConfig(): ConfigResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: classpath resource (development)
|
// Fallback: classpath resource (development)
|
||||||
Configuration::class.java.getResourceAsStream("/anytask.yaml")?.let { stream ->
|
Configuration::class.java.getResourceAsStream("/application.yaml")?.let { stream ->
|
||||||
val config = yaml.decodeFromString(serializer, stream.bufferedReader().readText())
|
val config = yaml.decodeFromString(serializer, stream.bufferedReader().readText())
|
||||||
logger.info("Loaded config from classpath:/anytask.yaml")
|
logger.info("Loaded config from classpath:/anytask.yaml")
|
||||||
return ConfigResult(config, null)
|
return ConfigResult(config, null)
|
||||||
@@ -64,7 +64,7 @@ fun loadConfig(): ConfigResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun saveConfig(config: Configuration, sourceFile: File?) {
|
fun saveConfig(config: Configuration, sourceFile: File?) {
|
||||||
val file = sourceFile ?: File(System.getProperty("user.home"), ".anytask/anytask.yaml")
|
val file = sourceFile ?: File(System.getProperty("user.home"), ".anytask/application.yaml")
|
||||||
file.parentFile?.mkdirs()
|
file.parentFile?.mkdirs()
|
||||||
val yaml = Yaml.default
|
val yaml = Yaml.default
|
||||||
file.writeText(yaml.encodeToString(Configuration.serializer(), config))
|
file.writeText(yaml.encodeToString(Configuration.serializer(), config))
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
connection:
|
|
||||||
apiKey: 2tkMSzFegWwzsQ+n9SpGwVjychEkCESWjV1/ftytXG4=
|
|
||||||
spaceId: bafyreiafzvfsrurvx4gvr2wwysgp5uugujzmbdg5hxnjlahfmx3ww6kxfy.172mmtcppmjtt
|
|
||||||