Anyone know of an example/tutorial for a ktor rest...
# ktor
b
Anyone know of an example/tutorial for a ktor rest server that uses productflavors so you can have different configuration variables for QA and production environments. Thanks
ł
Read about the HOCON file. You don’t need flavours 😉
a
You can use environment variables to configure each stage differently. Here you can find an information about taking values for parameters from environment variables in HOCON configuration.
b
Thanks guys. But I’m still not seeing how the Hocon file allows for diff configurations. I’m needs host =qa.example.com for one and host.example.com for another Thanks
a
@Barry Fawthrop could you please describe how the host is used in your Ktor application?
b
Host is the database sever(clusters) one for dev, one for was and one for prod
ł
ok, so…where is the problem? You can define in HOCON file something like this:
Copy code
ktor {
    environment = ${?KTOR_ENV}

    qa {
        host= xaxa
    }

    dev {
        host= dudu
    }
}
When you start your app, you have to define which config should start (qa or dev).
@Barry Fawthrop You can also load different files with config depending on env
b
Thanks Lukasz, “when you start your app” you mean a command line parameter like —env = prod, right?
ł
yeah
b
Thank you
😇 1