2
0
mirror of https://github.com/frappe/books.git synced 2024-09-19 19:19:02 +00:00

chore: change err_log_creds to log_creds

- add telemetry url
This commit is contained in:
18alantom 2022-03-14 12:31:09 +05:30
parent 97cf2479c2
commit c295ba0416
4 changed files with 25 additions and 20 deletions

View File

@ -26,9 +26,9 @@ jobs:
ERR_LOG_URL: ${{ secrets.ERR_LOG_URL }}
ERR_LOG_SECRET: ${{ secrets.ERR_LOG_SECRET }}
run: |
echo $ERR_LOG_KEY > err_log_creds.txt
echo $ERR_LOG_SECRET >> err_log_creds.txt
echo $ERR_LOG_URL >> err_log_creds.txt
echo $ERR_LOG_KEY > log_creds.txt
echo $ERR_LOG_SECRET >> log_creds.txt
echo $ERR_LOG_URL >> log_creds.txt
- name: Run build
env:
@ -71,9 +71,9 @@ jobs:
ERR_LOG_URL: ${{ secrets.ERR_LOG_URL }}
ERR_LOG_SECRET: ${{ secrets.ERR_LOG_SECRET }}
run: |
echo $ERR_LOG_KEY > err_log_creds.txt
echo $ERR_LOG_SECRET >> err_log_creds.txt
echo $ERR_LOG_URL >> err_log_creds.txt
echo $ERR_LOG_KEY > log_creds.txt
echo $ERR_LOG_SECRET >> log_creds.txt
echo $ERR_LOG_URL >> log_creds.txt
- name: Run build
env:
@ -113,9 +113,9 @@ jobs:
ERR_LOG_URL: ${{ secrets.ERR_LOG_URL }}
ERR_LOG_SECRET: ${{ secrets.ERR_LOG_SECRET }}
run: |
echo $ERR_LOG_KEY > err_log_creds.txt
echo $ERR_LOG_SECRET >> err_log_creds.txt
echo $ERR_LOG_URL >> err_log_creds.txt
echo $ERR_LOG_KEY > log_creds.txt
echo $ERR_LOG_SECRET >> log_creds.txt
echo $ERR_LOG_URL >> log_creds.txt
- name: Run build
env:

2
.gitignore vendored
View File

@ -24,4 +24,4 @@ yarn-error.log*
#Electron-builder output
/dist_electron
err_log_creds.txt
log_creds.txt

View File

@ -3,8 +3,8 @@ appId: io.frappe.books
afterSign: build/notarize.js
extraResources: [
{
from: 'err_log_creds.txt',
to: '../creds/err_log_creds.txt',
from: 'log_creds.txt',
to: '../creds/log_creds.txt',
}
]
mac:

View File

@ -4,24 +4,25 @@ import http from 'http';
import https from 'https';
import path from 'path';
function getUrlAndTokenString() {
export function getUrlAndTokenString() {
const inProduction = app.isPackaged;
const empty = { url: '', telemetryUrl: '', tokenString: '' };
let errLogCredsPath = path.join(
process.resourcesPath,
'../creds/err_log_creds.txt'
'../creds/log_creds.txt'
);
if (!fs.existsSync(errLogCredsPath)) {
errLogCredsPath = path.join(__dirname, '../err_log_creds.txt');
errLogCredsPath = path.join(__dirname, '../log_creds.txt');
}
if (!fs.existsSync(errLogCredsPath)) {
!inProduction && console.log(`${errLogCredsPath} doesn't exist, can't log`);
return;
return empty;
}
let apiKey, apiSecret, url;
let apiKey, apiSecret, url, telemetryUrl;
try {
[apiKey, apiSecret, url] = fs
[apiKey, apiSecret, url, telemetryUrl] = fs
.readFileSync(errLogCredsPath, 'utf-8')
.split('\n')
.filter((f) => f.length);
@ -30,10 +31,14 @@ function getUrlAndTokenString() {
console.log(`logging error using creds at: ${errLogCredsPath} failed`);
console.log(err);
}
return;
return empty;
}
return { url: encodeURI(url), tokenString: `token ${apiKey}:${apiSecret}` };
return {
url: encodeURI(url),
telemetryUrl: encodeURI(telemetryUrl),
tokenString: `token ${apiKey}:${apiSecret}`,
};
}
function post(bodyJson) {