UFGInsurance / mulint

Mule project linter
MIT License
6 stars 0 forks source link

POM placeholder variables prevent project from building correctly #13

Open cjnickel opened 6 years ago

cjnickel commented 6 years ago

With certain variables being set as placeholders in pom.xml, api.server.properties, and api.local.properties I run into Anypoint Studio errors that prevent project from building due to recursive cycles.

Example:

Setting database url values as ${policyholder.jdbc.url} in each of these files which requires devs to pass in via run configuration results in the error icon for project. image image image Note that passing in a -D parameter still has error

Potential Fix:

Setting the database url to an empty xml tag in pom.xml resolves the issue. e.g. <policyholder.jdbc.url />

cjnickel commented 6 years ago

@aoathout - You know maven and pom best. Any suggestions?

TrueWill commented 6 years ago

@cjnickel It's easy enough to check any property in the POM; I just need to know what to check it against. For instance mulint could validate that any property with a name containing "jdbc.url" had an empty value.

aoathout commented 6 years ago

@cjnickel I would have to pull the project down to take a look at why it isn't resolving when passing things in with '-D'. I can take a look once I get billing-process-api migrated to use wsflx

aoathout commented 6 years ago

@cjnickel I did some more tests on this. I changed the pom.xml to have the following for the jdbc.url:

jdbc:sqlserver://CRSQLDEV01.cr.unitedfiregroup.com;databaseName=CustomerPortal;integratedSecurity=true; The api.local.properties and api.server.properties files have the following for the jdbc url: policyholder.jdbc.url=${policyholder.jdbc.url} I set my run configuration maven params to this so I could run it since I can't do integrated auth (passwords removed): -Dmule.env=local "-Dpolicyholder.jdbc.url=jdbc:sqlserver://CRSQLDEV01.cr.unitedfiregroup.com;databaseName=CustomerPortal;user=ESB_CustomerPortal;password=;" I add this to my munit run configurations (passwords removed): -Dmule.env=local -Dhttps.port=8443 -Dpolicyholder.jdbc.url=jdbc:sqlserver://CRSQLDEV01.cr.unitedfiregroup.com;databaseName=CustomerPortal;user=ESB_CustomerPortal;password=; I can build from the command line. I can run the server and get results and I can run my munits in Studio Mulint does give this message: POM policyholder.jdbc.url: expected "${policyholder.jdbc.url}" but was "jdbc:sqlserver://CRSQLDEV01.cr.unitedfiregroup.com;databaseName=CustomerPortal;integratedSecurity=true;" Maybe we can check for an exact match, or for placeholder in that mulint check
cjnickel commented 6 years ago

@aoathout - Yeah, I wasn't sure if we wanted to default the pom.xml to integrated auth since a majority of devs are on Windows still. Like you mentioned we'll still have to specify a value in munit test configurations. I've been putting a random string since we're not doing integration tests (obviously will adjust that if/when we have integration tests).

Do the following rules sound correct:

I would expect this approach may change with mule 4 / studio 7 as it sounds like that honors POM better but maybe then we can switch it to have jdbc url with a placeholder for the password?

Side Note We should probably figure out how to distribute credentials securely. I think IT department has something that tracks credentials but not positive.

cjnickel commented 6 years ago

@TrueWill @aoathout There is also the property encryption within Anypoint Studio here and here. This does still require us to track the keys and encryption algorithm we used to encrypt though.