Skip to content

Commit 9d29b55

Browse files
committed
ID-30: 'source' property to specify source for values and passwords
1 parent 0103129 commit 9d29b55

File tree

9 files changed

+231
-60
lines changed

9 files changed

+231
-60
lines changed

CHANGELOG.adoc

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,119 @@
11
= Changelog
22

3+
== Version 0.10.0
4+
[cols="1,2,<10a", options="header"]
5+
|===
6+
|ID|Type|Description
7+
|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/issues/30[#30]
8+
|Enhancement
9+
|New property "source" for fields and certificates to specify the source for the values or passwords.
10+
11+
The are following advantages:
12+
13+
* Easy extensibility for new sources (e.g. environment variables).
14+
* Easier to find missing configurations (search for `"value": null` or `"password": null`).
15+
16+
*Environmentalized Fields*
17+
18+
For field values there are separate properties ("property" and "value") to configure the field value (see example below).
19+
20+
.Old Format
21+
[source,json]
22+
----
23+
{
24+
"field#0" {
25+
"property": null, <1>
26+
"type": "string",
27+
"used": true,
28+
"value": null <2>
29+
}
30+
}
31+
----
32+
<1> specifies a property as the source of the field value
33+
<2> literal field value
34+
35+
A new property "source" is introduced to specify the source of the field value.
36+
The property defines the kind of the "value" property.
37+
In case of "source" is equal to "value" the field value is directly configured by the value of the "value" property.
38+
In case of "source" is equal to "property" the field value is retrieved from the property named by the "value" property.
39+
40+
.New Format
41+
[source,json]
42+
----
43+
{
44+
"field#0": {
45+
"source": "property", <1>
46+
"type": string",
47+
"used": true,
48+
"value": "property.name" <2>
49+
},
50+
"field#1": {
51+
"source": "value", <3>
52+
"type": string",
53+
"used": true,
54+
"value": "field value" <4>
55+
}
56+
}
57+
----
58+
<1> specifies a property as the source of a field value
59+
<2> field value is retrieved from the property named `property.name`
60+
<3> field value is retrieved directly from "value"
61+
<4> literal field value
62+
63+
*Certificates*
64+
65+
For certificate passwords there are separate properties ("password" and "password-property") to configure the password (see example below).
66+
67+
.Old Format
68+
[source,json]
69+
----
70+
"update": {
71+
"file": "cert/server.p12",
72+
"password": "server.password", <1>
73+
"type": "p12"
74+
}
75+
...
76+
"update": {
77+
"file": "cert/server.p12",
78+
"password-property": "property.name", <3>
79+
"type": "p12"
80+
}
81+
----
82+
<1> literal password value
83+
<2> password is retrieved from a property named `property.name`
84+
85+
86+
A new property "source" is introduced to specify the source of the certificate password.
87+
The property defines the kind of the "password" property.
88+
In case of "source" is equal to "password" the password is directly configured by the value of the "password" property.
89+
In case of "source" is equal to "property" the password is retrieved form the property named by the "password" property.
90+
91+
.New Format
92+
[source,json]
93+
----
94+
"update": {
95+
"file": "cert/server.p12",
96+
"password": "server.password", <1>
97+
"source": "password" <2>
98+
"type": "p12"
99+
}
100+
...
101+
"update": {
102+
"file": "cert/server.p12",
103+
"password": "property.name", <3>
104+
"source": "property" <4>
105+
"type": "p12"
106+
}
107+
----
108+
<1> literal password value
109+
<2> password is retrieved directly from "password"
110+
<3> password is retrieved from the property named `property.name`
111+
<4> specifies a property as the source of the password
112+
113+
NOTE: Configuration files in the old format are automatically converted into the new format.
114+
|===
115+
116+
3117
== Version 0.9.2
4118
[cols="1,2,<10a", options="header"]
5119
|===

doc/getting-started/getting-started.adoc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:sectnums:
66
:source-highlighter: prettify
77

8-
:mvn-plugin-ver: 0.9.2
8+
:mvn-plugin-ver: 0.10.0
99

1010
Here you get a simple introduction on how to use the _Maven Plugin for Axway API Gateway_.
1111
It assumes that you are familiar with https://maven.apache.org[Apache Maven] and that you are familiar with PolicyStudio and the API Gateway.
@@ -329,9 +329,10 @@ For convenience the plugin will automatically add new fields to the configuratio
329329
"description": "",
330330
"fields": {
331331
"attributeValue#0": { <2>
332-
"type": "string", <3>
333-
"used": true, <4>
334-
"value": null <5>
332+
"source": "value", <3>
333+
"type": "string", <4>
334+
"used": true, <5>
335+
"value": null <6>
335336
}
336337
}
337338
}
@@ -340,11 +341,12 @@ For convenience the plugin will automatically add new fields to the configuratio
340341
----
341342
<1> Short handed key of the environmentalized entity.
342343
<2> Name and index of the environmentalized field.
343-
<3> Type of the field (just for documentation, don't change it).
344-
<4> Indicates if the configured field is used.
344+
<3> Specifies that the field value is literally retrieved form "value".
345+
<4> Type of the field (just for documentation, don't change it).
346+
<5> Indicates if the configured field is used.
345347
If _false_ the field is no longer environmentalized or the entity is renamed or removed.
346348
The property is automatically maintained by the plugin.
347-
<5> Value of the field. _null_ indicates an unconfigured field.
349+
<6> Literal value of the field. _null_ indicates an unconfigured field.
348350

349351
TIP: When the configuration file is written by the plugin, all JSON properties are sorted.
350352
This makes diff & merge easy.
@@ -355,6 +357,7 @@ Now configure the field in the configuration file.
355357
----
356358
{
357359
"attributeValue#0": {
360+
"source": "value",
358361
"type": "string",
359362
"used": true,
360363
"value": "Fred" <1>

doc/manual/_config-tool.adoc

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -204,28 +204,29 @@ The plugin and the configuration tool provides a set of predefined system proper
204204
"description": "Name for the 'Hello World' message.",
205205
"fields": {
206206
"attributeValue#0": { <3>
207-
"property": "foobar", <4>
207+
"source": "property", <4>
208208
"type": "string", <5>
209209
"used": true, <6>
210-
"value": null <7>
210+
"value": "foobar" <7>
211211
}
212212
}
213213
},
214214
"/[CircuitContainer]name=Hello World/[FilterCircuit]name=Hello World Message/[SetAttributeFilter]name=Build time": {
215215
"description": "Build time in ISO format.",
216216
"fields": {
217217
"attributeValue#0": {
218-
"property": "_system.build.datetime", <8>
218+
"source": "property",
219219
"type": "string",
220220
"used": true,
221-
"value": null
221+
"value": "_system.build.datetime" <8>
222222
}
223223
}
224224
}
225225
"/[CircuitContainer]name=Hello World/[FilterCircuit]name=Hello World Message/[SetAttributeFilter]name=Network zone": {
226226
"description": "Network zone the API Gateway is located.",
227227
"fields": {
228228
"attributeValue#0": {
229+
"source": "value"
229230
"type": "string",
230231
"used": true,
231232
"value": "internal" <9>
@@ -241,21 +242,18 @@ The plugin and the configuration tool provides a set of predefined system proper
241242
<1> Environmentalized entities are configured under an `entities` attribute.
242243
<2> Short hand key of the environmentalized entity.
243244
<3> Name and index of the environmentalized field.
244-
<4> Name of the property containing the value.
245-
_null_ or missing property indicates that no property is used to configure the value.
245+
<4> Declares a property (named `foobar`, see "value") as the source of the field value.
246246
<5> Type of the field (just for documentation, don't change it).
247247
<6> Indicates if the configured field is used.
248248
If _false_ the field is no longer environmentalized or the entity is renamed or removed.
249249
The property is automatically maintained by the plugin.
250-
<7> Value of the field.
251-
_null_ indicates that no value is defined.
252-
If `value` and `property` are configured the `property` value has precedence.
250+
<7> Name of the property containing the value.
253251
<8> Use value of the predefined system property `_system.build.datetime`.
254-
<9> Value for the field.
252+
<9> Literal value for the field.
255253
<10> An optional local definition of properties.
256254
If the same property is defined in a separate property file (see below), the separate property has precedence.
257255

258-
NOTE: If `value` and `property` is _null_ the field is treated as undefined and the build will fail.
256+
NOTE: If `value` is _null_ the field is treated as undefined and the build will fail.
259257

260258
=== Certificates
261259
The configuration for certificates is stored in a separate JSON file.
@@ -288,6 +286,7 @@ It specifies the alias of the certificates within the project and the source of
288286
"update": {
289287
"file": "cert/server.p12",
290288
"password": "server", <9>
289+
"source": "password", <10>
291290
"type": "p12"
292291
}
293292
},
@@ -298,12 +297,13 @@ It specifies the alias of the certificates within the project and the source of
298297
"subject": "CN=DST Root CA X3, O=Digital Signature Trust Co."
299298
}
300299
},
301-
"update": null <10>
300+
"update": null <11>
302301
},
303-
"test2": { <11>
302+
"test2": { <12>
304303
"update": {
305304
"file": "cert/server.p12",
306-
"password-property": "server.password", <12>
305+
"password": "server.password", <13>
306+
"source": "property", <14>
307307
"type": "p12"
308308
}
309309
}
@@ -321,11 +321,13 @@ A missing `update` attribute indicates a new/unconfigured certificate.
321321
<7> Path to the new certificate file.
322322
<8> Type of the certificate.
323323
`crt` for certificates and `p12` for certificates with key.
324-
<9> Password to for the `.p12` file.
325-
<10> _null_ value indicates that the certificate will not be updated.
326-
<11> Certificate without a `origin` attribute.
324+
<9> Literal password for the `.p12` file.
325+
<10> Declares a property (`server.password`, see "password") as the source for the password.
326+
<11> _null_ value indicates that the certificate will not be updated.
327+
<12> Certificate without a `origin` attribute.
327328
This certificate will be added to the certificate store.
328-
<12> Password for the `.p12` file is retrieved from the property configuration file.
329+
<13> Password for the `.p12` file is retrieved from the property configuration file.
330+
<14> Declares the property "password" as the source of the password for the `.p12` file.
329331

330332
=== Properties
331333

doc/manual/user-guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ifdef::env-github[]
1818
:warning-caption: :warning:
1919
endif::[]
2020

21-
:mvn-plugin-ver: 0.9.2
21+
:mvn-plugin-ver: 0.10.0
2222

2323
== About the Plugin
2424

example/config-tool/config/gateway.certs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"not_after": "2020-08-23T20:26:00+02:00",
1414
"subject": "CN=staged, O=ACME Inc., C=EX"
1515
},
16-
"password-property": "cert.password.staged.server",
16+
"password": "cert.password.staged.server",
17+
"source": "property",
1718
"type": "p12"
1819
}
1920
},

example/config-tool/config/gateway.config.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,40 @@
44
"description": "",
55
"fields": {
66
"attributeValue#0": {
7-
"property": "artifact",
7+
"source": "property",
88
"type": "string",
99
"used": true,
10-
"value": null
10+
"value": "artifact"
1111
}
1212
}
1313
},
1414
"/[CircuitContainer]name=Demo/[FilterCircuit]name=Show Build Version/[SetAttributeFilter]name=Set build timestamp": {
1515
"description": "",
1616
"fields": {
1717
"attributeValue#0": {
18-
"property": "_system.build.datetime",
18+
"source": "property",
1919
"type": "string",
2020
"used": true,
21-
"value": null
21+
"value": "_system.build.datetime"
2222
}
2323
}
24-
},
24+
},
2525
"/[NetService]name=Service/[HTTP]name=Default Service/[SSLInterface]name=HTTPS": {
2626
"description": "",
2727
"fields": {
2828
"address#0": {
29-
"property": "service.address",
30-
"type": "string",
31-
"used": true,
32-
"value": null
29+
"source": "property",
30+
"type": "string",
31+
"used": true,
32+
"value": "service.address"
3333
},
3434
"port#0": {
35-
"property": "service.port",
35+
"source": "property",
3636
"type": "string",
3737
"used": true,
38-
"value": null
38+
"value": "service.port"
3939
}
4040
}
4141
}
4242
}
43-
}
43+
}

example/config-tool/gateway.fed

-262 KB
Binary file not shown.

example/getting-started/dpl-hello-world/src/main/axwgw/gateway.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "",
55
"fields": {
66
"attributeValue#0": {
7+
"source": "value",
78
"type": "string",
89
"used": true,
910
"value": "Fred"

0 commit comments

Comments
 (0)