Skip to content
Snippets Groups Projects
Commit 9c9e4674 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #1037 Migrate server.js

parent bb180336
Branches
Tags
No related merge requests found
......@@ -32,6 +32,7 @@ test/blockchain/*.js
test/blockchain/*.js.map
test/blockchain/lib/*.js
test/blockchain/lib/*.js.map
server.js*
app/cli.js*
app/lib/*.js*
app/lib/blockchain/*.js
......
......@@ -44,14 +44,17 @@ export class ConfDTO {
public msWindow: number,
public sigWindow: number,
public swichOnTimeAheadBy: number,
public pair: Keypair | null,
public pair: Keypair,
public remoteport: number,
public remotehost: string,
public remoteipv4: string,
public remoteipv6: string,
public port: number,
public ipv4: string,
public ipv6: string,
) {}
static mock() {
return new ConfDTO("", "", [], [], 0, 0, 0.6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, false, 0, 0, 0, 0, 0, null, 0, "", "", "")
return new ConfDTO("", "", [], [], 0, 0, 0.6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, false, 0, 0, 0, 0, 0, { pub:'', sec:'' }, 0, "", "", "", 0, "", "")
}
}
\ No newline at end of file
import {SQLiteDriver} from "../dal/drivers/SQLiteDriver"
import {CFSCore} from "../dal/fileDALs/CFSCore"
import {WoTBObject} from "../wot"
const opts = require('optimist').argv;
const path = require('path');
......@@ -29,7 +30,6 @@ const dir = module.exports = {
getHomeFS: async (isMemory:boolean, theHome:string) => {
const home = theHome || dir.getHome();
await someDelayFix();
const params:any = {
home: home
};
......@@ -45,10 +45,9 @@ const dir = module.exports = {
getHomeParams: async (isMemory:boolean, theHome:string) => {
const params:any = await dir.getHomeFS(isMemory, theHome)
const home = params.home;
await someDelayFix()
if (isMemory) {
params.dbf = () => new SQLiteDriver(':memory:');
params.wotb = require('../wot').WoTBObject.memoryInstance();
params.wotb = WoTBObject.memoryInstance();
} else {
const sqlitePath = path.join(home, dir.DUNITER_DB_NAME + '.db');
params.dbf = () => new SQLiteDriver(sqlitePath);
......@@ -57,7 +56,7 @@ const dir = module.exports = {
if (!existsFile) {
fs.closeSync(fs.openSync(wotbFilePath, 'w'));
}
params.wotb = require('../wot').WoTBObject.fileInstance(wotbFilePath);
params.wotb = WoTBObject.fileInstance(wotbFilePath);
}
return params;
},
......@@ -67,8 +66,3 @@ const dir = module.exports = {
return fsHandler.makeTree('');
}
}
const someDelayFix = () => new Promise((resolve) => {
setTimeout(resolve, 100);
})
......@@ -2,7 +2,7 @@ const wotb = require('wotb');
export interface WoTBInterface {
fileInstance: (filepath:string) => any
memoryInstance: (filepath:string) => any
memoryInstance: () => any
setVerbose: (verbose:boolean) => void
}
......
......@@ -1013,7 +1013,7 @@ Pius cliquez sur "Find". Vous obtiendrez le résultat suivant :
<img src="https://forum.duniter.org/uploads/default/original/1X/48f80f1e07828edab1601f4414f605b995143ddd.png" width="471" height="227">
Double-cliquez sur le résultat trouvé, et vous serez alors amené au fichier `server.js`, ligne 75. Ajoutez-y un point d'arrêt :
Double-cliquez sur le résultat trouvé, et vous serez alors amené au fichier `server.ts`, ligne 75. Ajoutez-y un point d'arrêt :
<img src="https://forum.duniter.org/uploads/default/original/1X/789c7fbb457d3f780316a2cf164ed45f82d0c701.png" width="448" height="94">
......
......@@ -5,7 +5,7 @@ const path = require('path');
const util = require('util');
const stream = require('stream');
const _ = require('underscore');
const Server = require('./server');
const Server = require('./server').Server
const directory = require('./app/lib/system/directory');
const constants = require('./app/lib/constants');
const CLI = require('./app/cli').ExecuteCommand
......
This diff is collapsed.
server.ts 0 → 100644
This diff is collapsed.
......@@ -10,6 +10,7 @@
"noImplicitReturns": true
},
"include": [
"server.ts",
"app",
"bin",
"test"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment