aotrautils-srv 0.0.267 → 0.0.268
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (23/11/2022-18:45:22)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4827,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4827
4827
|
|
|
4828
4828
|
|
|
4829
4829
|
|
|
4830
|
-
/*utils SERVER library associated with aotra version : «1_29072022-2359 (
|
|
4830
|
+
/*utils SERVER library associated with aotra version : «1_29072022-2359 (23/11/2022-18:45:22)»*/
|
|
4831
4831
|
/*-----------------------------------------------------------------------------*/
|
|
4832
4832
|
|
|
4833
4833
|
|
|
@@ -4986,60 +4986,62 @@ if(typeof(fs)==="undefined"){
|
|
|
4986
4986
|
|
|
4987
4987
|
// -Server :
|
|
4988
4988
|
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
//
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
//
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
//
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
//
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
//
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
//
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
4989
|
+
getServerParams=function(portParam=null,certPathParam=null,keyPathParam=null){
|
|
4990
|
+
|
|
4991
|
+
// Node dependencies :
|
|
4992
|
+
// https=require("https");
|
|
4993
|
+
// fs=require("fs");
|
|
4994
|
+
|
|
4995
|
+
if(!https){
|
|
4996
|
+
// TRACE
|
|
4997
|
+
console.log("WARN : Could not find the nodejs dependency «https», aborting SSL setup.");
|
|
4998
|
+
return null;
|
|
4999
|
+
}
|
|
5000
|
+
if(!fs){
|
|
5001
|
+
// TRACE
|
|
5002
|
+
console.log("WARN : Could not find the nodejs dependency «fs», aborting SSL setup.");
|
|
5003
|
+
return null;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
5006
|
+
const result={};
|
|
5007
|
+
|
|
5008
|
+
// We read the command-line arguments if needed :
|
|
5009
|
+
let argCLPort;
|
|
5010
|
+
let argCLCertPath;
|
|
5011
|
+
let argCLKeyPath;
|
|
5012
|
+
process.argv.forEach(function (val, i){
|
|
5013
|
+
if(i<=1) return;
|
|
5014
|
+
else if(i==2) argCLPort=val;
|
|
5015
|
+
else if(i==3) argCLCertPath=val;
|
|
5016
|
+
else if(i==4) argCLKeyPath=val;
|
|
5017
|
+
});
|
|
5018
|
+
|
|
5019
|
+
// Console, command-line arguments OVERRIDE parameters values :
|
|
5020
|
+
|
|
5021
|
+
result.port=nonull(argCLPort,portParam);
|
|
5022
|
+
result.certPath=null;
|
|
5023
|
+
result.keyPath=null;
|
|
5024
|
+
result.isSecure=(certPathParam || keyPathParam);
|
|
5025
|
+
|
|
5026
|
+
if(result.isSecure){
|
|
5027
|
+
result.certPath=nonull(argCLCertPath,certPathParam);
|
|
5028
|
+
result.keyPath=nonull(argCLKeyPath,keyPathParam);
|
|
5029
|
+
}
|
|
5030
|
+
|
|
5031
|
+
// Eventual encryption options :
|
|
5032
|
+
result.sslOptions=null;
|
|
5033
|
+
if(result.isSecure){
|
|
5034
|
+
result.sslOptions={
|
|
5035
|
+
cert: fs.readFileSync(certPath),
|
|
5036
|
+
key: fs.readFileSync(keyPath),
|
|
5037
|
+
};
|
|
5038
|
+
}
|
|
5039
|
+
|
|
5040
|
+
return result;
|
|
5041
|
+
}
|
|
5042
|
+
|
|
5043
|
+
|
|
5044
|
+
|
|
5043
5045
|
|
|
5044
5046
|
|
|
5045
5047
|
// NODE ONLY SERVER / CLIENTS :
|
|
@@ -5945,11 +5947,13 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
|
|
|
5945
5947
|
// EXAMPLE : node orita-srv.js hash orita.global@keyHash 1234567890
|
|
5946
5948
|
console.log("Server launched.");
|
|
5947
5949
|
|
|
5950
|
+
|
|
5948
5951
|
// We read the command-line arguments if needed :
|
|
5949
5952
|
|
|
5950
5953
|
let argCLPort;
|
|
5951
5954
|
let argCLCertPath;
|
|
5952
5955
|
let argCLKeyPath;
|
|
5956
|
+
|
|
5953
5957
|
let serverConfig={};
|
|
5954
5958
|
let isForceUnsecure;
|
|
5955
5959
|
|
|
@@ -5982,7 +5986,10 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
|
|
|
5982
5986
|
});
|
|
5983
5987
|
isForceUnsecure=(argCLCertPath==="unsecure");
|
|
5984
5988
|
|
|
5985
|
-
|
|
5989
|
+
|
|
5990
|
+
|
|
5991
|
+
|
|
5992
|
+
|
|
5986
5993
|
const aotraNodeServer={config:serverConfig};
|
|
5987
5994
|
aotraNodeServer.serverManager={ start:()=>{/*DEFAULT START FUNCTION, WILL BE OVERRIDEN LATER*/}};
|
|
5988
5995
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.268",
|
|
4
4
|
"main": "aotrautils-srv.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|