https://kotlinlang.org logo
#ktor
Title
# ktor
j

jean

08/03/2021, 8:41 AM
I’m having configuration issue with
application.conf
, I declared the following :
Copy code
ktor {
    deployment {
        port = 8080
        port = ${?PORT}
    }
    application {
        modules = [ ... ]
    }
    jwt {
        secret = "secret"
        issuer = "<http://0.0.0.0:8080/>"
        audience = "<http://0.0.0.0:8080/login>"
        realm = "Access to 'login'"
    }
    pbkdf2 {
        salt = "salt"
        iterations = "10000"
        keyLength = "512"
    }
}
when I use
environment.config.property("jwt.secret").getString()
from
Application.kt
I receive this error
Caused by: io.ktor.config.ApplicationConfigurationException: Property jwt.secret not found.
What am I doing wrong here?
d

duuusha

08/03/2021, 8:57 AM
try to move the
jwt
group outside the
ktor
group:
Copy code
ktor {
    deployment {
        port = 8080
        port = ${?PORT}
    }
    application {
        modules = [ ... ]
    }

    pbkdf2 {
        salt = "salt"
        iterations = "10000"
        keyLength = "512"
    }
}
jwt {
    secret = "secret"
    issuer = "<http://0.0.0.0:8080/>"
    audience = "<http://0.0.0.0:8080/login>"
    realm = "Access to 'login'"
}
👍 3
j

jean

08/03/2021, 9:16 AM
It works, thanks! Somehow the doc gave me the impression everything should be inside the the ktor group
☝️ 1
37 Views