Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEVOPS-299] Fix TLS certificate path #454

Merged
merged 3 commits into from
Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import path from 'path';
export default (platform, env, appName) => {
switch (platform) {
case 'darwin': {
return path.join(env['HOME'], 'Library', 'Application Support', appName, 'Logs');
return path.join(env['HOME'], 'Library', 'Application Support', appName);
}
case 'win32': {
return path.join(env['APPDATA'], appName, 'Logs');
return path.join(env['APPDATA'], appName);
}
case 'linux': {
return path.join(env['HOME'], '.config', appName, 'Logs');
return path.join(env['HOME'], '.config', appName);
}
default: {
console.log('Unsupported platform');
Expand Down
20 changes: 12 additions & 8 deletions electron/main.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ import Log from 'electron-log';
import osxMenu from './menus/osx';
import winLinuxMenu from './menus/win-linux';
import ipcApi from './ipc-api';
import getLogsFolderPath from './lib/getLogsFolderPath';
import getRuntimeFolderPath from './lib/getRuntimeFolderPath';
import { daedalusLogger } from './lib/remoteLog';

const APP_NAME = 'Daedalus';
// Configure default logger levels for console and file outputs
const appLogFolderPath = getLogsFolderPath(process.platform, process.env, APP_NAME);
const runtimeFolderPath = getRuntimeFolderPath(process.platform, process.env, APP_NAME);
const appLogFolderPath = path.join(runtimeFolderPath, 'Logs')
const logFilePath = path.join(appLogFolderPath, APP_NAME + '.log');
Log.transports.console.level = 'warn';
Log.transports.file.level = 'debug';
Log.transports.file.file = logFilePath;
// TODO: depends on launcher script current directory, move this to getRuntimeFolderPath location
//const caProductionPath = path.join(runtimeFolderPath, 'CA', 'tls', 'ca', 'ca.crt');
const caProductionPath = path.join(process.cwd(), 'tls', 'ca', 'ca.crt');

try {
let sendLogsToRemoteServer;
Expand Down Expand Up @@ -140,16 +144,16 @@ app.on('ready', async () => {
* so that it can be used in HTTP and Websocket connections.
*/
try {
// Path to certificate in development
let pathToCertificate = '../tls/ca.crt';

if (isProd) {
// --> PATH TO CERTIFICATE IN PRODUCTION:
pathToCertificate = '../../../tls/ca/ca.crt';
var pathToCertificate = caProductionPath;
} else {
// Path to certificate in development
var pathToCertificate = path.join(__dirname, '../tls/ca.crt');
}
Log.info('Using certificates from: ' + caProductionPath);

Object.assign(global, {
ca: fs.readFileSync(path.join(__dirname, pathToCertificate)),
ca: fs.readFileSync(pathToCertificate),
});

} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions installers/Launcher.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ launcherArgs launcher = unwords $
batchCmdNewline | os == "mingw32" = "^\r\n"
| otherwise = mempty
walletTopology | os == "mingw32" = ["--topology", quote "%DAEDALUS_DIR%\\wallet-topology.yaml"]
| otherwise = mempty
| otherwise = ["--topology", quote "./wallet-topology.yaml"]
tlsBase | os == "mingw32" = "%DAEDALUS_DIR%\\" <> "tls" <> (pathSeparator : [])
| otherwise = runtimePath launcher <> "tls" <> (pathSeparator : [])
| otherwise = "./" <> "tls" <> (pathSeparator : [])

quote :: String -> String
quote p = "\"" <> p <> "\""
1 change: 1 addition & 0 deletions installers/MacInstaller.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ main = do
echo "Preparing files ..."
copyFile "cardano-launcher" (dir <> "/cardano-launcher")
copyFile "cardano-node" (dir <> "/cardano-node")
copyFile "wallet-topology.yaml" (dir <> "/wallet-topology.yaml")
copyFile "log-config-prod.yaml" (dir <> "/log-config-prod.yaml")
copyFile "data/ip-dht-mappings" (dir <> "/ip-dht-mappings")
copyFile "data/ip-dht-mappings" (dir <> "/ip-dht-mappings")
Expand Down