Skip to content

add .config/spring-boot/application-<application-name>-<profile>.<config format> files #39156

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

Closed
xenoterracide opened this issue Jan 16, 2024 · 5 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@xenoterracide
Copy link
Contributor

xenoterracide commented Jan 16, 2024

2 common problems.

  1. I have secure credentials I want to keep out of the repo, they are hopefully only shared to me and not group shared
  2. I don't like a setting, like log format that's the default (I personally think console log is over verbose and I always force color on because Idea is dumb? I'm not going to raise issues to change those defaults though, for obvious reasons). The repository owners probably don't want these changes as they may only make sense when debugging tests and things locally.

devtools properties are insufficient because it intentionally work at test runtime.

Although it would be easy to add your own property source with a more explicit path, that kind of breaks "conventional" and now I have to convince every single application/repository I use to add such a thing. I'm not actually certain on the right way to support the various formats spring does without creating a property source for each.

These configurations need to be per app, because they might each have different credentials. Also per profile for similar reasons.

I'm not sure if .config is hard coded or if it actually supports the XDG spec, which I have no idea how complex it would be for me to support the XDG spec, you could probably do it with a SPeL expression, but still...

So my solution is for Spring Boot to simply add support for

.config/spring-boot/application-<application-name>-<profile>.<config format>

grossly simplistic way as workaround

@PropertySource(value = "file:///${user.home}/.config/spring-boot/application-${spring.application.name}.properties", ignoreResourceNotFound = true)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 16, 2024
@philwebb
Copy link
Member

@xenoterracide
Copy link
Contributor Author

xenoterracide commented Jan 18, 2024

@xenoterracide
Copy link
Contributor Author

xenoterracide commented May 3, 2024

been thinking on this more. I think that the pattern I came up with is flawed in that it would be indistinguishable from profile only. Very tired today, but to expand the problem space.

We need to be able to have private profile specific, application specific (higher priority) and application profile specific. Honestly devtools specific is kind of silly... Since it could be handled with profile, maybe one that devtools itself adds.

So, new thought. Every single properties, etc, that exists is related to an application.

@PropertySource(
  value = "file:///${user.home}/.config/spring-boot/${spring.application.name}.properties",
  ignoreResourceNotFound = true
)
@PropertySource(
  value = "file:///${user.home}/.config/spring-boot/application-local.properties",
  ignoreResourceNotFound = true
)

local in this case would refer to a profile only.

file:///${user.home}/.config/spring-boot/${spring.application.name}.{ext}
file:///${user.home}/.config/spring-boot/${spring.application.name}-{profile}.{ext}
file:///${user.home}/.config/spring-boot/application-{profile}.{ext},

then profile only files could also exist.

A motivation for this is that I like to set my own properties locally because certain things annoy me in local dev, specifically I think log statements are far more verbose regarding things like timestamps than I've almost ever wanted them to be. So I like to change the format pattern myself.

currently my own implementation using the annotations is limited, and I don't think there's a way to do this with just annotations. For my personal needs it doesn't seem super worth it to implement the full thing since I can essentially stick to my own config formats and statically define profiles for this.

I would be willing to PR this though, given how often I keep coming back to this feature. A little guidance would be nice (on accepted result and code location to start) and a bit of a guarantee that should any part of my code be accepted that primary git authorship would be retained.

@snicoll snicoll added the for: team-meeting An issue we'd like to discuss as a team to make progress label Jul 16, 2024
@philwebb
Copy link
Member

Thanks for the suggestion, but we're not keen to add any more complexity to this area.

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2024
@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Jul 24, 2024
@xenoterracide
Copy link
Contributor Author

So is spring boot never going to get something that allows a standardized location to put credentials external to the application root for developers to avoid accidental committing. That's what I read you as saying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

4 participants