a year ago
Hello i'm building and deploying this docker file:
# ---- Build Stage ---- FROM eclipse-temurin:21-jdk AS build WORKDIR /app COPY . . RUN ./gradlew clean shadowJar # ---- Run Stage ---- FROM eclipse-temurin:21-jre WORKDIR /app COPY --from=build /app/build/libs/displate-mail.jar app.jar RUN useradd ktoruser USER ktoruser EXPOSE 8080 ENTRYPOINT ["java", "-jar", "app.jar"]
but the deploy keep failing this this error
at io.ktor.server.engine.CommandLineKt.commandLineEnvironment(CommandLine.kt:98)
at io.ktor.server.netty.EngineMain.main(EngineMain.kt:20)
Exception in thread "main" java.util.NoSuchElementException: Char sequence is empty.
at kotlin.text.StringsKt___StringsKt.first(_Strings.kt:76)
at io.ktor.server.config.yaml.YamlConfigKt.resolveValue(YamlConfig.kt:173)
at io.ktor.server.config.yaml.YamlConfigKt.access$resolveValue(YamlConfig.kt:1)
at io.ktor.server.config.yaml.YamlConfig.checkEnvironmentVariables$check(YamlConfig.kt:132)
at io.ktor.server.config.yaml.YamlConfig.checkEnvironmentVariables$check(YamlConfig.kt:134)
at io.ktor.server.config.yaml.YamlConfig.checkEnvironmentVariables$check(YamlConfig.kt:134)
at io.ktor.server.config.yaml.YamlConfig.checkEnvironmentVariables$check(YamlConfig.kt:134)
at io.ktor.server.config.yaml.YamlConfig.checkEnvironmentVariables(YamlConfig.kt:139)
at io.ktor.server.config.yaml.YamlConfigJvmKt.configFromString(YamlConfigJvm.kt:39)
seems that env vars are not injected
5 Replies
a year ago
If i hardcode values, for example like this (with dummies values)
ktor: deployment: port: 8080 development: true auth: apiKey: internal: "S2Levonh3AWRYdPkQiNwLsF2YYTSHJVJNEnxW5GMuJCyTe42j9LyDuau3R5vcpZyCzCwuv" providers: mailgun: user: "admin" apiKey: "S2Levonh3AWRYdPkQiNwLsF2YYTSHJVJNEnxW5GMuJCyTe42j9LyDuau3R5vcpZyCzCwuv" endpoint: "https://default.mailgun.endpoint" the service is deployed withous issues
a year ago
i need an answer since we are deciding if we want to host our infrastructure on railways since we have a lot of microservices written using ktor
a year ago
a year ago
solved, for reference, if you declare env variables without using {}, everything working fine:
ktor: deployment: port: $PORT development: $IS_DEV auth: apiKey: internal: $AUTH_API_KEY_INTERNAL providers: mailgun: user: $MAILGUN_USER apiKey: $MAILGUN_API_KEY endpoint: $MAILGUN_ENDPOINT
thanks anyways!
Status changed to Solved uxuz • 11 months ago