pmcf 3.19.5 → 3.19.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -74,12 +74,16 @@ generates config packages for:
74
74
  * [Parameters](#parameters-9)
75
75
  * [serviceEndpoints](#serviceendpoints)
76
76
  * [Parameters](#parameters-10)
77
- * [sectionLines](#sectionlines)
77
+ * [domainName](#domainname)
78
78
  * [Parameters](#parameters-11)
79
- * [asArray](#asarray)
79
+ * [domainFromDominName](#domainfromdominname)
80
80
  * [Parameters](#parameters-12)
81
- * [asIterator](#asiterator)
81
+ * [sectionLines](#sectionlines)
82
82
  * [Parameters](#parameters-13)
83
+ * [asArray](#asarray)
84
+ * [Parameters](#parameters-14)
85
+ * [asIterator](#asiterator)
86
+ * [Parameters](#parameters-15)
83
87
 
84
88
  ## Base
85
89
 
@@ -237,6 +241,28 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl
237
241
 
238
242
  Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | any)** 
239
243
 
244
+ ## domainName
245
+
246
+ Appends default domain if name does not already have a domain.
247
+
248
+ ### Parameters
249
+
250
+ * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
251
+ * `defaultDomain` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
252
+
253
+ Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** 
254
+
255
+ ## domainFromDominName
256
+
257
+ Extracts domain name from a name.
258
+
259
+ ### Parameters
260
+
261
+ * `domainName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
262
+ * `defaultDomain` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
263
+
264
+ Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** 
265
+
240
266
  ## sectionLines
241
267
 
242
268
  ### Parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "3.19.5",
3
+ "version": "3.19.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/host.mjs CHANGED
@@ -498,7 +498,7 @@ export class Host extends ServiceOwner {
498
498
  for (const service of this.services) {
499
499
  if (service.systemdConfigs) {
500
500
  for (const { serviceName, configFileName, content } of asArray(
501
- service.systemdConfigs(this.name)
501
+ service.expand(service.systemdConfigs(this.name))
502
502
  )) {
503
503
  await writeLines(dir, configFileName, sectionLines(...content));
504
504
 
package/src/service.mjs CHANGED
@@ -89,6 +89,14 @@ export class Service extends Base {
89
89
  return ServiceTypeDefinition;
90
90
  }
91
91
 
92
+ get isTemplate() {
93
+ // TODO
94
+ if (this.fullName.startsWith("/services")) {
95
+ return true;
96
+ }
97
+ return super.isTemplate;
98
+ }
99
+
92
100
  toString() {
93
101
  return `${super.toString()}[${this.type}]`;
94
102
  }
@@ -123,25 +123,30 @@ export class OpenLDAPService extends Service {
123
123
  "setfacl -m u:ldap:r /etc/letsencrypt/archive/*/privkey*.pem"
124
124
  );
125
125
 
126
- await writeLines(join(packageData.dir, "etc/conf.d"), "slapd", [
127
- "SLAPD_OPTIONS=",
128
- "SLAPD_URLS=ldap:/// ldaps:/// ldapi://%2Frun%2Fldapi"
129
- ]);
126
+ await writeLines(
127
+ join(packageData.dir, "etc/conf.d"),
128
+ "slapd",
129
+ this.expand([
130
+ "SLAPD_OPTIONS=",
131
+ "SLAPD_URLS=ldap:/// ldaps:/// ldapi://%2Frun%2Fldapi"
132
+ ])
133
+ );
130
134
 
131
135
  await writeLines(
132
136
  join(packageData.dir, "/var/lib/openldap/openldap-data"),
133
137
  "DB_CONFIG",
134
- [
138
+ this.expand([
135
139
  "set_cachesize 0 16777216 1",
136
140
  "set_lg_regionmax 65536",
137
141
  "set_lg_bsize 524288"
138
- ]
142
+ ])
139
143
  );
140
144
 
141
- await writeLines(join(packageData.dir, "etc/openldap"), "ldap.conf", [
142
- `BASE ${this.baseDN}`,
143
- `URI ${this.uri}`
144
- ]);
145
+ await writeLines(
146
+ join(packageData.dir, "etc/openldap"),
147
+ "ldap.conf",
148
+ this.expand([`BASE ${this.baseDN}`, `URI ${this.uri}`])
149
+ );
145
150
 
146
151
  yield packageData;
147
152
  }