How to enable enableSwaggerCodegen to an existing jhipster project? - swagger

I have a monolitic project where initially enableSwaggerCodegen = false. But now I want to add some custom API using the enableSwaggerCodegen functionality.
How do I add that to my existing jhipster project?

I believe you can set "enableSwaggerCodegen": true in .yo-rc.json and run command jhipster again and it will add files that are needed for SwaggerCodeGen

Related

How do i change the firestore database in a copied ios project?

I have created an Xcode project and implemented firebase.
I have copied the project and renamed it.
I have created a new firebase project and i have replaced the Firebase config whatever info.plist.
I have reinstalled the pods.
I checked the code looking for a reference to the database.
And after all this work the new application still uses the old database from the previous project.
When i create a new user it is added in the old project.
Somebody has any clue?
I dont wanna share the code
I'm assuming you're trying to access your database directly using the REST API. GCP checks your credentials to know which database you're accessing.
If you're running your app locally there are a couple ways you could be using to connect to the database. If you're using service account key, authentication will be done accessing the 'GOOGLE_APPLICATION_CREDENTIALS' variable in your environment. You might need to change that to a new service key of your new project. Watch out as these keys give full access to your database. You can check other access options here: https://firebase.google.com/docs/firestore/use-rest-api.
If you're accessing a local emulator (which I find unlikely), you can find more info here: https://firebase.google.com/docs/emulator-suite/connect_firestore
If you're having this problem on the deployed app, GCP will use by default the app engine service account to try and access the project's database. You might be constructing your Firestore API referencing the name of another project. This would probably only work if you've done this: google function: accessing firestore database of another project.
1- You have to be sure that you've changed the rules related to the database which is located here:
2- Make sure that once you created the app in firebase you've used the same bundle identifier
3- You can't use two different databases on the same project
4- Don't forget to enable the database and users in the new project

Where is the default login page for the spring security core plugin?

I have installed the spring security core plugin. I need to modify the login page to look like my existing website. I have searched the entire project and cannot find it. I am running grails 2.4 and spring-security-core:2.0-RC5. Where can this pesky little file be? Can someone who is not a complete greenhorn help a fellow out?
As #Abs points out, the file is at target/work/plugins/spring-security-core-2.0-RC5/grails-app/views/login/auth.gsp but you shouldn't edit plugin files. Other developers on your team won't have access to the modified files and if you delete the target directory you'll lose your changes since the target directory is only a temporary work location.
Instead, copy the file to the same relative location in your application and make changes there. Create grails-app/views/login and copy the file there and make whatever changes you want.
This technique works for most plugin files, not just GSPs. The compilation order and classpath are configured such that application files and classes override plugin files if they're in the same location/package.
You can find the default login page here
targt->work->plugins->spring-security-core-2.0-RC5->grails-app->views->login>auth.gsp

Spring Cloud Config Server - Where to set encrypt.key to enable /encrypt endpoint

I have a Spring Cloud Config app with the Spring Cloud Security dependencies. I'm trying to hit the /encrypt endpoint to encrypt a password.
According to the docs at http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_key_management I believe I need to set a symmetric key using "encrypt.key". But I can't figure out where to put this; all combinations I've tried result in {"description":"No key was installed for encryption service","status":"NO_KEY"} when I attempt to POST to /encrypt.
If I POST a key to /key, the /encrypt works perfectly, so I'm pretty sure that everything else is setup correctly. It also works fine using the environment variable ENCRYPT_KEY, or by using a system property encrypt.key. I just can't figure out where to place the encrypt.key within a configuration file. Is there a sample on this?
Thanks #pVilaca, this is indeed what the documentation says, but setting the key in application.properties or application.yml won't work.
Through experimentation I've found that the only place you can set the encrypt.key property is an ENCRYPT_KEY environment variable, a system property, bootstrap.properties, bootstrap.yml, or calling the /key endpoint.
Not sure why application.properties or application.yml don't work in this case. Setting this key must have more of an impact on the startup process than it would appear.
Setting Spring Cloud Version to 'Brixton.SR5' worked for me. For some reason, setting 'encrypt.key' in either application.properties/yml or bootstrap.properties/yml in later Spring Cloud Version does not work anymore.
check properties tag of pom.xml file. If you are using version 2 or 3 of Dalston, change it to:
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
and it should be working fine. In my case i was using version 3 and changing it to version 1 resolved the issue for me.
Reference:
https://github.com/spring-cloud/spring-cloud-config/issues/767
If you're using spring cloud with spring boot, that is the method that is described on the documentation that you mentioned, you've two 'main' properties files.
bootstrap.[properties,yml]
To modify the startup behaviour you can change the location of the config server using bootstrap.properties (like application.properties but for the bootstrap phase of an application context)
application.[properties,yml]
where the "application" is injected as the "spring.config.name" in the SpringApplication (i.e. what is normally "application" in a regular Spring Boot app)
source: Spring Cloud Config Documentation
So, it should be enough to set the encrypt.keyin your application.[properties,yml] file (or the alternative name if specified)

Copy Razor-Views for Self-hosting NancyFx?

I started out with a simple MVC-site using NancyFx with Razor-views (.cshtml) and Nancy.Hosting.Aspnet, using IIS Express. Now I adapted the project to a self-hosting service using Nancy.Hosting.Self (and TopShelf).
However, to provide the Views, it seems I need to change their properties from None & Do not copy to Content & Copy if newer, so they are copied to .\bin\Debug\.
One consequence is that changes to the Views will not be shown/updated until a restart. Even when working in debug-mode, where caching is disabled by default. I know this is just a minor annoyance, but still an annoyance, and it is nice to be able to try (cs)HTML-changes right away. So I was wondering is there a way to fix this, e.g. to prevent having to set the files to Copy if newer?
You can provide a custom root path that looks directly at the views folder in your project.
You will need to set these values:
#if DEBUG
StaticConfiguration.Caching.EnableRuntimeViewDiscovery = true
EnableRuntimeViewUpdates = true
#endif

May I use sf_sandbox directly as my symfony project?

As sf_sandbox has set up the symfony environment, why not develop in the sandbox directly and then upload on to server? What are the disadvantages of sandbox compared with configuring manually?
I think there is no drawback in following this approach. sf_sandbox is a pre-configured symfony project. One of the pluses is that is saves you time in creating your project and initializing an empty application (by default this is called frontend).
It's more a matter of taste rather than a matter of right or wrong. It's up to you!
Note: If you follow this approach you have to make some initial configuration (steps 1,2,3 would be done anyway if you started your project from scratch):
Rename the project
Change the config/properties.ini file
Change the config/databases.yml file (by default sf_sandbox uses sqlite database)
Remove the data/sandbox.db database file

Resources