@routstr/cocod 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -110,7 +110,7 @@ Defaults:
110
110
 
111
111
  Logging defaults:
112
112
 
113
- - Structured JSON logs are written to `~/.cocod/daemon.log`
113
+ - Structured JSON logs are written to `<base>/daemon.log`
114
114
  - Rotation keeps 5 files at 5 MiB each by default
115
115
  - Override with `COCOD_LOG_LEVEL`, `COCOD_LOG_MAX_BYTES`, and `COCOD_LOG_MAX_FILES`
116
116
 
@@ -3,8 +3,10 @@
3
3
  "version": "0.0.12",
4
4
  "transport": {
5
5
  "protocol": "http",
6
+ "baseDirEnv": "COCOD_DIR",
7
+ "defaultBaseDir": "~/.cocod",
6
8
  "unixSocketEnv": "COCOD_SOCKET",
7
- "defaultUnixSocket": "~/.cocod/cocod.sock"
9
+ "defaultUnixSocket": "<COCOD_DIR>/cocod.sock"
8
10
  },
9
11
  "responseContract": {
10
12
  "success": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routstr/cocod",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "private": false,
package/src/cli-shared.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { program } from "commander";
2
2
 
3
- const CONFIG_DIR = `${process.env.HOME || process.env.USERPROFILE}/.cocod`;
4
- const SOCKET_PATH = process.env.COCOD_SOCKET || `${CONFIG_DIR}/cocod.sock`;
3
+ import { LOG_FILE, SOCKET_PATH } from "./utils/config";
5
4
 
6
5
  export interface CommandResponse {
7
6
  output?: unknown;
@@ -124,7 +123,9 @@ export async function startDaemonProcess(): Promise<void> {
124
123
  if (!warningShown.value && elapsedMs >= DAEMON_SLOW_START_WARNING_MS) {
125
124
  warningShown.value = true;
126
125
  console.log("Daemon is taking longer than expected, please wait...");
127
- console.log(`Tip: run 'cocod logs --follow' or 'tail -n ${DAEMON_START_LOG_LINES} ~/.cocod/daemon.log' in another terminal.`);
126
+ console.log(
127
+ `Tip: run 'cocod logs --follow' or 'tail -n ${DAEMON_START_LOG_LINES} ${LOG_FILE}' in another terminal.`,
128
+ );
128
129
  }
129
130
 
130
131
  if (elapsedMs >= DAEMON_START_TIMEOUT_MS) {
@@ -1,5 +1,7 @@
1
1
  import type { Manager } from "coco-cashu-core";
2
2
 
3
+ import { CONFIG_FILE } from "./config";
4
+
3
5
  export interface UninitializedState {
4
6
  status: "UNINITIALIZED";
5
7
  }
@@ -97,7 +99,7 @@ export class DaemonStateManager {
97
99
  if (state.status !== "UNINITIALIZED") {
98
100
  return Response.json(
99
101
  {
100
- error: "Wallet already initialized. Delete ~/.cocod/config.json to reset.",
102
+ error: `Wallet already initialized. Delete ${CONFIG_FILE} to reset.`,
101
103
  },
102
104
  { status: 409 },
103
105
  );