chore: configure base url (#179)

* chore: set base api url

* chore: change config varibales names

* chore: rename env var

* chore: set base url to match wakatime cli usage
This commit is contained in:
Juan Sebastian velez Posada
2023-03-28 17:50:32 -05:00
committed by GitHub
parent 1e9e233066
commit c2ead5149d
9 changed files with 87 additions and 37 deletions

View File

@@ -53,11 +53,12 @@ export interface Config {
* API key use to query wakatime api
*/
apiKey: '';
apiUrl: string;
colors: Colors;
/**
* Url from which to detect if the user is logged in
*/
currentUserApiUrl: string;
currentUserApiEndPoint: string;
/**
* Time for idle state of the browser
* The user is considered idle if there was
@@ -69,7 +70,7 @@ export interface Config {
/**
* Url to which to send the heartbeat
*/
heartbeatApiUrl: string;
heartbeatApiEndPoint: string;
hostname: string;
/**
@@ -91,7 +92,7 @@ export interface Config {
/**
* Get stats from the wakatime api
*/
summariesApiUrl: string;
summariesApiEndPoint: string;
/**
* Options for theme
*/
@@ -118,6 +119,8 @@ const config: Config = {
apiKey: '',
apiUrl: process.env.API_URL ?? 'https://wakatime.com/api/v1',
colors: {
allGood: '',
lightTheme: 'white',
@@ -125,16 +128,14 @@ const config: Config = {
notSignedIn: 'red',
},
currentUserApiUrl:
process.env.CURRENT_USER_API_URL ?? 'https://wakatime.com/api/v1/users/current',
currentUserApiEndPoint: process.env.CURRENT_USER_API_URL ?? '/users/current',
detectionIntervalInSeconds: 60,
devSites:
'https://codepen.io/\nhttps://www.codewars.com/\nhttps://dev.to/\nhttps://github.com/\nhttps://www.hackerrank.com/\nhttps://leetcode.com/\nhttps://developer.mozilla.org/en-US/\nhttps://stackoverflow.com/\nhttps://www.udemy.com/\nhttps://www.w3schools.com/',
heartbeatApiUrl:
process.env.HEART_BEAT_API_URL ?? 'https://wakatime.com/api/v1/users/current/heartbeats',
heartbeatApiEndPoint: process.env.HEARTBEAT_API_URL ?? '/users/current/heartbeats',
hostname: '',
@@ -152,8 +153,7 @@ const config: Config = {
states: ['allGood', 'notLogging', 'notSignedIn', 'blacklisted', 'whitelisted'],
summariesApiUrl:
process.env.SUMMARIES_API_URL ?? 'https://wakatime.com/api/v1/users/current/summaries',
summariesApiEndPoint: process.env.SUMMARIES_API_URL ?? '/users/current/summaries',
theme: 'light',