Skip to content

Conversation

@simon-brooke
Copy link

If you're building a project which may be delivered as an executable jar file, it's obvious that parameters can (and should) be supplied as environment variables. However, if you're delivering a project as a war file to be run within a servlet container, this isn't really possible as the war file may be deployed into an already running servlet engine whose environment variables one cannot readily alter.

While I agree that passing parameters as context-params in the web.xml file violates the principles of the 12 factor app, it is a well established mechanism for specifying parameters within the context of a web-app packaged as a war.

This patch provides a mechanism for specifying context parameters in the :ring map of the project.clj file. A key :context-params may be specified in this map; if it is specified, and its value is a map, then a context-param element will be generated in the generated web.xml file for each key/value pair in that map.

Copy link
Collaborator

@MichaelBlume MichaelBlume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpic, otherwise looks good.

"Take this `params-map` and construct from it a sequence of
s-expression representations of context-param elements."
[params-map]
(if
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a when, since it doesn't appear to have an else clause

"Take this `params-map` and construct from it a sequence of
s-expression representations of context-param elements."
[params-map]
(if

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(if
(when

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

Successfully merging this pull request may close these issues.

3 participants