piston/api/src/globals.js

25 lines
750 B
JavaScript
Raw Normal View History

2021-02-20 15:13:56 +01:00
// Globals are things the user shouldn't change in config, but is good to not use inline constants for
2021-02-20 23:39:03 +01:00
const is_docker = require('is-docker');
const fss = require('fs');
const platform = `${is_docker() ? 'docker' : 'baremetal'}-${
fss.read_file_sync('/etc/os-release')
2021-02-20 15:13:56 +01:00
.toString()
2021-02-20 23:39:03 +01:00
.split('\n')
.find(x=>x.startsWith('ID'))
.replace('ID=','')
}`;
2021-02-20 15:13:56 +01:00
module.exports = {
data_directories: {
2021-02-20 23:39:03 +01:00
cache: 'cache',
packages: 'packages',
runtimes: 'runtimes',
jobs: 'jobs'
2021-02-20 15:13:56 +01:00
},
data_files:{
2021-02-20 23:39:03 +01:00
state: 'state.json'
2021-02-20 15:13:56 +01:00
},
2021-02-20 23:39:03 +01:00
version: require('../package.json').version,
2021-02-20 15:13:56 +01:00
platform,
2021-02-20 23:39:03 +01:00
pkg_installed_file: '.ppman-installed' //Used as indication for if a package was installed
};