Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring - application.yaml #125

Open
mamaorha opened this issue Jan 1, 2023 · 2 comments
Open

spring - application.yaml #125

mamaorha opened this issue Jan 1, 2023 · 2 comments

Comments

@mamaorha
Copy link

mamaorha commented Jan 1, 2023

it seems like the application.yaml under resources is ignored when deploying (it does work when running local).

@omnibrain
Copy link

I'm facing the same problem. Any documentation on how to configure spring or define some env variables would be very helpful

@mamaorha
Copy link
Author

mamaorha commented Jan 2, 2023

i ended up using env variables via the gradle config and adjust them on runtime due to the fact the teraform wasnt able to parse complex env names.

part i added to build gradle:

kotless {
    webapp {
        lambda {
            environment = hashMapOf(
                "MYSQL_PASS" to "MY_VALUE"
            )
        }
    }
}

later on my main class i reassigned them via:

@SpringBootApplication
open class Application : Kotless() {
    init {
        System.setProperty("spring.datasource.password", System.getenv()["MYSQL_PASS"])
    }

    override val bootKlass: KClass<*> = this::class
}

small note that secrets should not be under the "gradle" file as you probably want to push the file to your git.
instead you can & should use some secret manager like aws have to offer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants