• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Orckestra / orc-scripts / 101636

11 Feb 2025 07:42PM UTC coverage: 34.628% (-1.0%) from 35.578%
101636

push

Azure Pipelines

martindufresne-orc
5.0.0-dev.1

153 of 431 branches covered (35.5%)

Branch coverage included in aggregate %.

275 of 805 relevant lines covered (34.16%)

4.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/scripts/start.js
1
const DevServer = require("webpack-dev-server");
×
2
const webpack = require("webpack");
×
3
const path = require("path");
×
4
const fs = require("fs");
×
5

6
const HOST = process.env.HOSTNAME || "localhost";
×
7

8
const args = process.argv.slice(2);
×
9
const argPort = args.indexOf("--port") !== -1 ? args[args.indexOf("--port") + 1] : null;
×
10
const PORT = argPort || process.env.PORT || 5000;
×
11

12
const findSslPasswordFromParametersFile = (certFile) => {
×
13
        // reference: https://hals.app/blog/recursively-read-parent-folder-nodejs/
14

15
        let parentDirectory = path.dirname(certFile);
×
16
        while (fs.existsSync(parentDirectory)) {
×
17
                console.log("Looking for certificate password in: " + parentDirectory)
×
18
                const fileToFindPath = path.join(parentDirectory, "parameters.dev.xml");
×
19
                if (fs.existsSync(fileToFindPath)) {
×
20
                        const fileContent = fs.readFileSync(fileToFindPath, "utf8");
×
21

22
                        // Using regex to parse the XML to avoid adding a dependency on an XML package
23

24
                        const matchResult = /<param\s+name="SSL_CertificatePfxPassword"\s+value="(?<Value>[^"]+)"\s*\/>/.exec(fileContent);
×
25
                        if (matchResult && matchResult.groups && matchResult.groups['Value']) {
×
26
                                console.log("Certificate password found");
×
27
                                return matchResult.groups['Value'];
×
28
                        }
29

30
                        console.warn("Could not find SSL_CertificatePfxPassword in file " + fileToFindPath)
×
31
                        return null;
×
32
                }
33

34
                // The trick is here:
35
                // Using path.dirname() of a directory returns the parent directory!
36
                const parentDirname = path.dirname(parentDirectory);
×
37
                // But only to a certain point (file system root) (So to avoid infinite loops lets stop here)
38
                if (parentDirectory === parentDirname) {
×
39
                        return null;
×
40
                }
41

42
                parentDirectory = parentDirname;
×
43
        }
44

45
        return null;
×
46
}
47

48
const config = require("../config/webpack.config.js");
×
49
const options = {
×
50
        historyApiFallback: true,
51
        hot: "only",
52
        port: PORT,
53
        host: HOST,
54
        static: './dist',
55
        devMiddleware: {
56
                publicPath: process.env.WEBPACK_PUBLIC_PATH || "/",
×
57
        },
58
};
59

60
if (HOST !== "localhost" || args.indexOf("--https") !== -1 || process.env.HTTPS) {
×
61
        options.server = 'https';
×
62
}
63

64
if (options.server === 'https' && process.env.SSL_CERT_PATH) {
×
65
        options.server = {
×
66
                type: 'https',
67
                options: {
68
                        pfx: process.env.SSL_CERT_PATH,
69
                        passphrase: process.env.SSL_CERT_PASSWORD || findSslPasswordFromParametersFile(process.env.SSL_CERT_PATH),
×
70
                },
71
        }
72
}
73

74
const compiler = webpack(config);
×
75

76
const server = new DevServer(options, compiler);
×
77

78
(async () => {
×
79
        await server.start();
×
80
})();
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc