Streamline directory layout and consolidate state and cache paths
This commit is contained in:
1 parent
9cf3e8ce56
commit
d3642b93d8
13 files changed
+94
-29
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { homedir } from "node:os";
|
||||
import { SEAL_CONFIG_DIR } from "../paths.js";
|
||||
import {
|
||||
CorpTokenCache,
|
||||
HoseAuthCache,
|
||||
@@ -9,14 +9,14 @@ import {
|
||||
TokenStoreSchema
|
||||
} from "./types.js";
|
||||
|
||||
const PRIMARY_TOKEN_STORE = join(homedir(), ".config", "seal-use", "sealTokens.json");
|
||||
const LEGACY_TOKEN_STORE = join(homedir(), ".config", "seal-home", "sealTokens.json");
|
||||
const PRIMARY_TOKEN_STORE = join(SEAL_CONFIG_DIR, "tokens.json");
|
||||
const MIGRATION_TOKEN_STORE = join(SEAL_CONFIG_DIR, "sealTokens.json");
|
||||
|
||||
function resolveReadStorePath(): string {
|
||||
const configured = (process.env.SEAL_USE_TOKEN_STORE ?? process.env.SEAL_HOME_TOKEN_STORE)?.trim();
|
||||
if (configured) return configured;
|
||||
if (existsSync(PRIMARY_TOKEN_STORE)) return PRIMARY_TOKEN_STORE;
|
||||
if (existsSync(LEGACY_TOKEN_STORE)) return LEGACY_TOKEN_STORE;
|
||||
if (existsSync(MIGRATION_TOKEN_STORE)) return MIGRATION_TOKEN_STORE;
|
||||
return PRIMARY_TOKEN_STORE;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user