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

Thiyagu

01/09/2020, 1:48 PM
Hey All, Anyone used
aws paramstore
storing the config value and resolving at runtime at the application start?
b

Ben

01/09/2020, 3:27 PM
I’ve used it in a spring project before and it worked well.
a

Alex

01/10/2020, 8:51 AM
yes, looks like this for me:
Copy code
return MapApplicationConfig(
  ...
  Pair("db.password", ssmService.getSsmParameter("${stage}.db.password", true)),
  ...
)
and the
ssmService
utilize the AWS
SsmClient
Straight forward.
t

Thiyagu

01/10/2020, 1:36 PM
@Alex thanks.. It's really simple one..
Actually I'm planning to migrate from DW to ktor.. in the current setup we have
application.yml
which has value like
Copy code
db:
   name: test
   username: {{user_name}}
In these user name should be replaced by the
ssmService
at runtime. How do i go about this one?
a

Alex

01/10/2020, 2:02 PM
When you use
application.conf
you still need to create your db-connection somehow at the start of the app .. so you can decide: • are the keys for
db.*
in your config just ssm-keys? and you resolve them when you initialize your db • or do you prefix your ssm keys with
ssm:
(or stuff like this) in your config, to just resolve specific values from ssm (when
config._startsWith_(*"ssm:"*)
) For me I found it personally easier to use
embeddedServer
and use
MapApplicationConfig
.
t

Thiyagu

01/10/2020, 2:21 PM
Ah! It give me some idea to look into . Thanks
a

Alex

01/10/2020, 2:28 PM
nice 👍
2 Views