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

Add default properties in application.properties when creating a new project #1232

Open
DavideD opened this issue Aug 3, 2023 · 10 comments
Open
Labels

Comments

@DavideD
Copy link

DavideD commented Aug 3, 2023

I'm not sure if this is the right place for this issue, but let me know otherwise.

When I create a new project and include the Hibernate Reactive extension using the start with quarkus page, the created application.properties is empty. This is a bit annoying because now I have to go and look in the documentation for the most common properties that i need.

I think it would be nice to have at least some properties related to the extensions I've selected.
They can just be commented.

For example, for Hibernate Reactive, I would like to have an application.properties similar to this out-of-the-box:

#%prod.quarkus.datasource.db-kind=postgresql
#%prod.quarkus.datasource.username=quarkus_test
#%prod.quarkus.datasource.password=quarkus_test

#quarkus.hibernate-orm.database.generation=drop-and-create
#quarkus.hibernate-orm.sql-load-script=import.sql

# Log SQL queries
quarkus.hibernate-orm.log.sql=false
# Format SQL query when logged
quarkus-hibernate-orm_quarkus.hibernate-orm.log.format-sql=true

# Reactive config
#%prod.quarkus.datasource.reactive.url=vertx-reactive:postgresql://localhost/quarkus_test

My most common scenario is figure out which properties to set for logging.
But in case of Hibernate, it's also nice to have the properties about the creation of the schema and datasource configuration.

I haven't checked all the extensions, maybe this is something that's already done somewhere else.

@DavideD DavideD added the feature label Aug 3, 2023
@ia3andy
Copy link
Collaborator

ia3andy commented Sep 28, 2023

We don't add them as part of the default project, there is a simple reason, better have awesome tools to solve this rather than polluting the initial project:

image - The Quarkus Tools plugin for IDEs https://quarkus.io/guides/ide-tooling: image

BTW @angelozerr the current implementation for application.properties has 2 issues:

  • it doesn't work with Quarkiverse extensions (or maybe I need to do something from the extension that I don't know, in case we should warn people about this)
  • it would be nice to show the doc for the suggested configuration parameters

@angelozerr
Copy link

angelozerr commented Sep 28, 2023

it doesn't work with Quarkiverse extensions (or maybe I need to do something from the extension that I don't know, in case we should warn people about this)

It should except if some properties are hard coded. Please create an inssue on IJ Quarkus to explain which properties are missing and give us a link with a sample project, thanks!

it would be nice to show the doc for the suggested configuration parameters

I have implemented this feature and it should work but you need to activate Show documentation completion popiup, see my comment at redhat-developer/intellij-quarkus#1115 (comment) and you should see
image

@angelozerr
Copy link

@DavideD I think your need is to have code snippet. We provide today code snippets by using the file https://github.com/redhat-developer/quarkus-ls/blob/master/quarkus.ls.ext/com.redhat.quarkus.ls/src/main/resources/com/redhat/quarkus/snippets/quarkus-properties.json

You should have qds or qj which are available according your Quarkus dependency and generate a code snippet. For your case of hibernate, I suggest that you create a PR to add your hibernate code snippet in https://github.com/redhat-developer/quarkus-ls/blob/master/quarkus.ls.ext/com.redhat.quarkus.ls/src/main/resources/com/redhat/quarkus/snippets/quarkus-properties.json

This JSON file belong to the Quarkus language server extension which is integrated in vscode, Eclipse IDE or IJ.

@DavideD
Copy link
Author

DavideD commented Sep 29, 2023

We don't add them as part of the default project, there is a simple reason, better have awesome tools to solve this rather than polluting the initial project:

Maybe I'm the only one that creates projects for demo, prototyping or just playing around.
But I don't understand why one cannot have both. You could add a checkbox for it: Add common properties to application.properties. Plus, you could include in it how to access the dev UI for more properties.

The dev UI is nice, but editing a text file is much faster and can be done without starting quarkus first.
And not everybody uses the IDE extension for Quarkus.

Maybe my suggestion is not going to work for every extensions, but for Hibernate ORM or Reactive, one pretty much always has to add the right connection url and needs to know how to enable logs.

Anyway, this is not a hill I'm willing to die on. It's too tied to personal experience and I don't plan to work on it anyway.
If you guys don't think it's something helpful, feel free to close the issue.

@angelozerr
Copy link

And not everybody uses the IDE extension for Quarkus.

Which IDE/Editor are you using? If you use vscode, Eclipse IDE or IJ you will have this Quarkus / Qute support. Do you use it?

@DavideD
Copy link
Author

DavideD commented Sep 29, 2023

I use vanilla IntelliJ community edition. Frankly, to implement what you are suggesting, I would have to do extra research (I don't know what code snippets are or how they work). Editing a properties file feels easier (as a noob).

@DavideD
Copy link
Author

DavideD commented Sep 29, 2023

By the way, when I've create this issue, I was thinking about code.quarkus.io.
I didn't have any IDE or tools in mind.

@ia3andy
Copy link
Collaborator

ia3andy commented Sep 29, 2023

FYI one other simple reason/issue is that we are using application.yml for codestarts definition (and comments are not kept jackson yaml :-/)

@ia3andy
Copy link
Collaborator

ia3andy commented Sep 29, 2023

I do agree that if a config is important in 90% of created apps, then having it commented out could make sense.

@DavideD
Copy link
Author

DavideD commented Sep 29, 2023

OK, I haven't thought about the YAML configuration.
In that case, I would disable the feature, or set the default value for the properties without comments.
Still pretty helpful IMHO

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

No branches or pull requests

3 participants