|
2 | 2 | import { spawn } from 'child_process'; |
3 | 3 | import { mkdirSync, readFileSync, statSync, watchFile, writeFileSync } from 'fs'; |
4 | 4 | import jsyaml from 'js-yaml'; |
5 | | -import { homedir } from 'os'; |
6 | 5 | import { join } from 'path'; |
7 | 6 | import logger from '../logger/index.js'; |
8 | | - |
9 | | -// construct paths |
10 | | -const xdgConfigHome = process.env.XDG_CONFIG_HOME || join(homedir(), '.config'); |
11 | | -export const baseFolder = join(xdgConfigHome, 'exoframe'); |
12 | | -const configPath = join(baseFolder, 'server.config.yml'); |
13 | | -const publicKeysPath = join(homedir(), '.ssh'); |
14 | | -export const extensionsFolder = join(baseFolder, 'extensions'); |
15 | | -export const recipesFolder = join(baseFolder, 'recipes'); |
16 | | -// dir for temporary files used to build docker images |
17 | | -export const tempDockerDir = join(baseFolder, 'deploying'); |
| 7 | +import { baseFolder, configPath, extensionsFolder, logFolder, publicKeysPath, recipesFolder } from './paths.js'; |
18 | 8 |
|
19 | 9 | // create base folder if doesn't exist |
20 | 10 | try { |
|
49 | 39 | spawn('npm', ['init', '-y', '--silent'], { cwd: recipesFolder }); |
50 | 40 | } |
51 | 41 |
|
52 | | -// construct log path |
53 | | -export const logFolder = join(xdgConfigHome, 'exoframe', 'exoframe-server'); |
54 | | - |
55 | 42 | // create logs folder if doesn't exist |
56 | 43 | try { |
57 | 44 | statSync(logFolder); |
|
0 commit comments