-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindowsService.ts
More file actions
35 lines (26 loc) · 996 Bytes
/
windowsService.ts
File metadata and controls
35 lines (26 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import path from 'node:path'
import type { ServiceConfig } from 'node-windows'
import { getConfigProperty } from './helpers/config.helpers.js'
const _dirname = '.'
/**
* Get the Windows service configuration
* @param configFilePath - Optional path to the config file (defaults to data/config.js)
* @returns ServiceConfig object for node-windows
*/
export function getServiceConfig(configFilePath?: string): ServiceConfig {
const config: ServiceConfig = {
name: `ShiftLog (${getConfigProperty('application.instance')})`,
description:
'A work management system with work order recording, shift activity logging, and timesheet tracking.',
script: path.join(_dirname, 'index.js')
}
if (configFilePath !== undefined && configFilePath !== '') {
config.env = {
name: 'CONFIG_FILE',
value: configFilePath
}
}
return config
}
// Maintain backward compatibility with default export
export const serviceConfig: ServiceConfig = getServiceConfig()