dcp-client 5.1.4 → 5.1.6
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/index.js
CHANGED
|
@@ -1170,7 +1170,13 @@ exports.createConfigFragments = async function dcpClient$$createConfigFragments(
|
|
|
1170
1170
|
* 5 - pull the scheduler's config, and layer it on top of the current configuration to find scheduler
|
|
1171
1171
|
*/
|
|
1172
1172
|
const etc = process.env.DCP_ETCDIR || (os.platform() === 'win32' ? process.env.ALLUSERSPROFILE : '/etc');
|
|
1173
|
-
|
|
1173
|
+
let resourceDir;
|
|
1174
|
+
if (process.env.DCP_RESOURCE_DIR)
|
|
1175
|
+
resourceDir = process.env.DCP_RESOURCE_DIR;
|
|
1176
|
+
else if (process.env.XDG_DATA_HOME)
|
|
1177
|
+
resourceDir = path.resolve(process.env.XDG_DATA_HOME, 'dcp');
|
|
1178
|
+
else
|
|
1179
|
+
resourceDir = path.resolve(os.homedir(), '.dcp');
|
|
1174
1180
|
let programName = options.programName;
|
|
1175
1181
|
const progDir = process.mainModule ? path.dirname(process.mainModule.filename) : process.cwd();
|
|
1176
1182
|
var remoteConfig, remoteConfigKVIN;
|
|
@@ -1224,9 +1230,9 @@ exports.createConfigFragments = async function dcpClient$$createConfigFragments(
|
|
|
1224
1230
|
* Note: this code is Sep 2022, overriding older spec, spec update to come. /wg
|
|
1225
1231
|
*
|
|
1226
1232
|
* The basic idea is that key collisions are overridden on the basis of "most specificity to current
|
|
1227
|
-
* executable wins" - so local disk is stronger than remote network config,
|
|
1233
|
+
* executable wins" - so local disk is stronger than remote network config, resourceDir is stronger than
|
|
1228
1234
|
* /etc, BUT we also have an override in /etc, and specific-program-name config files in /etc are more
|
|
1229
|
-
* powerful than those in the user's
|
|
1235
|
+
* powerful than those in the user's resourceDir. The reason for this is so that sysadmins can create
|
|
1230
1236
|
* strongish machine-wide configuration/security-theatre policies. These are not real security, as
|
|
1231
1237
|
* any intelligent user can always change the source code to do whatever they please, but it does
|
|
1232
1238
|
* make sense for campus configurations where sysadmins believe the machines are locked down, etc.
|
|
@@ -1235,9 +1241,9 @@ exports.createConfigFragments = async function dcpClient$$createConfigFragments(
|
|
|
1235
1241
|
addConfigFile(localConfig, etc, 'dcp/dcp-config');
|
|
1236
1242
|
await addConfigRKey(localConfig, 'HKLM', 'dcp/dcp-config');
|
|
1237
1243
|
cn = addConfigFile(localConfig, options.configName && path.resolve(progDir, options.configName));
|
|
1238
|
-
addConfigFile(localConfig,
|
|
1244
|
+
addConfigFile(localConfig, resourceDir, 'dcp-config');
|
|
1239
1245
|
await addConfigRKey(localConfig, 'HKCU', 'dcp/dcp-config');
|
|
1240
|
-
addConfigFile(localConfig,
|
|
1246
|
+
addConfigFile(localConfig, resourceDir, `${programName}/dcp-config`);
|
|
1241
1247
|
await addConfigRKey(localConfig, 'HKCU', `dcp/${programName}/dcp-config`);
|
|
1242
1248
|
addConfig (localConfig, initConfig);
|
|
1243
1249
|
addConfigEnv (localConfig, 'DCP_CONFIG_');
|
package/ns-map.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dcp-client",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.6",
|
|
4
4
|
"dcp": {
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "353e61c1189b2131d9dfa1e397a43fe9da830845",
|
|
6
6
|
"repository": "git@gitlab.com:Distributed-Compute-Protocol/dcp.git"
|
|
7
7
|
},
|
|
8
8
|
"description": "Core libraries for accessing DCP network",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
|
|
13
|
-
process.env.
|
|
13
|
+
process.env.DCP_RESOURCE_DIR = path.resolve(path.dirname(module.filename), '../test-pseudo-root/home/username/.dcp');
|
|
14
14
|
process.env.DCP_ETCDIR = path.resolve(path.dirname(module.filename), '../test-pseudo-root/etc');
|
|
15
15
|
if (!process.env.DCP_CONFIG_LOCATION)
|
|
16
16
|
process.env.DCP_CONFIG_LOCATION = '';
|
|
@@ -27,11 +27,11 @@ if (require('os').platform() === 'win32')
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/* Some tests don't load dcp-client */
|
|
30
|
-
var
|
|
30
|
+
var resourceDir;
|
|
31
31
|
try
|
|
32
32
|
{
|
|
33
|
-
|
|
33
|
+
resourceDir = require('dcp/resource-dir');
|
|
34
34
|
}
|
|
35
35
|
catch(e) {};
|
|
36
|
-
if (
|
|
37
|
-
|
|
36
|
+
if (resourceDir)
|
|
37
|
+
resourceDir.setResourceDir(process.env.DCP_RESOURCE_DIR);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
This directory is used as the user's homedir while tests are running.
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
The hidden directory, `.dcp`, acts as the test fixture for `DCP_RESOURCE_DIR`.
|