# Config

## File

```text
.quill/config.json
```

```json
{
  "publicKey": "598cf61ba7a7e31711622841",
  "privateKey": "302e020100300506032b656e04220420a04aaf1a7ecdb69b004d994bd4f609ad4a3c74d5ce5870f09fa9af62f91d087c"
}
```

## Set with a command

```sh
quill login
quill login --environment <id>
quill logout
```

```sh
quill init --public-key <public key> --private-key <private key>
```

## Environment variables

```sh
QUILL_PRIVATE_KEY=<private key> QUILL_PUBLIC_KEY=<public key> quill dashboard list
```

## Precedence

1. `QUILL_*` environment variables
2. `.quill/config.json`

## Settings

| Key          | Environment variable | Written by                                 | Cleared by     |
| ------------ | -------------------- | ------------------------------------------ | -------------- |
| `publicKey`  | `QUILL_PUBLIC_KEY`   | `quill login`, `quill init`, sandbox setup | `quill logout` |
| `privateKey` | `QUILL_PRIVATE_KEY`  | `quill login`, `quill init`                | `quill logout` |

## Reference

The CLI reads two files. `.quill/config.json` in the folder `quill` runs
from holds the environment, so each project has its own, and
`~/.quill/config.json` holds the Clerk session (`clerkRefreshToken`,
`clerkOrgId`), so one sign-in serves every project. `QUILL_CONFIG_DIR`
moves the second file to another folder. Every key can also be set with an
environment variable: `QUILL_` and the key in upper snake case, such as
`QUILL_METADATA_SERVER_URL` for `metadataServerUrl`.

```ts
type Config = {
  // Environment
  publicKey?: string;
  privateKey?: string;
  metadataServerUrl?: string;
  setupPending?: boolean;

  // Sign-in
  clerkRefreshToken?: string;
  clerkOrgId?: string;

  // Sandbox
  sourceClientId?: string;
  sessionId?: string;

  // Output and commands
  verbose?: boolean;
  objectState?: boolean;
  enableAdminCommands?: boolean;
};
```
