chore(pockethost): add env-paths support

This commit is contained in:
Ben Allfree 2024-06-05 10:11:47 -07:00
parent 34acdf1e2c
commit 81e89bbdc8
3 changed files with 6 additions and 2 deletions

View File

@ -60,6 +60,7 @@
"devcert": "^1.2.2",
"dockerode": "^3.3.5",
"dotenv": "^16.3.1",
"env-paths": "^3.0.0",
"event-source-polyfill": "^1.0.31",
"eventsource": "^2.0.2",
"exit-hook": "^4.0.0",

3
pnpm-lock.yaml generated
View File

@ -53,6 +53,9 @@ importers:
dotenv:
specifier: ^16.3.1
version: 16.3.1
env-paths:
specifier: ^3.0.0
version: 3.0.0
event-source-polyfill:
specifier: ^1.0.31
version: 1.0.31

View File

@ -17,6 +17,7 @@ import {
import { forEach } from '@s-libs/micro-dash'
import devcert from 'devcert'
import dotenv from 'dotenv'
import envPaths from 'env-paths'
import { findUpSync } from 'find-up'
import { mkdirSync, realpathSync, writeFileSync } from 'fs'
import { dirname, join, resolve } from 'path'
@ -26,8 +27,7 @@ dotenv.config({ path: `.env` })
const realScriptPath = realpathSync(process.argv[1]!)
export const _PH_HOME =
process.env.PH_HOME || join(process.env.HOME || resolve(`~`), `.pockethost`)
export const _PH_HOME = process.env.PH_HOME || envPaths(`pockethost`).data
export const _SSL_HOME = join(_PH_HOME, `ssl`)