Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ PORT=3456 # Daemon port
DATABASE_PATH=./pins.db # SQLite database
CAR_STORAGE_PATH=./cars # CAR file directory
LOG_LEVEL=info # Logging level
WITH_CDN=true # Enable/Disable CDN for content uploads
```

### Default Directories
Expand Down Expand Up @@ -193,4 +194,4 @@ Dual-licensed under [MIT](LICENSE-MIT) + [Apache 2.0](LICENSE-APACHE)

- [IPFS Pinning Service API](https://ipfs.github.io/pinning-services-api-spec/)
- [Synapse SDK](https://github.com/filecoin-project/synapse-sdk)
- [USDFC Documentation](https://docs.secured.finance/usdfc-stablecoin)
- [USDFC Documentation](https://docs.secured.finance/usdfc-stablecoin)
11 changes: 11 additions & 0 deletions src/common/env-vars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Generic helpers for environment variable parsing and validation.
*/

export const envToBool = (value: string | undefined, defaultValue: boolean): boolean => {
if (value === undefined) return defaultValue
const normalized = value.trim().toLowerCase()
if (['1', 'true', 'yes', 'on'].includes(normalized)) return true
if (['0', 'false', 'no', 'off'].includes(normalized)) return false
return defaultValue
}
3 changes: 2 additions & 1 deletion src/synapse/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
type SynapseOptions,
} from '@filoz/synapse-sdk'
import type { Logger } from 'pino'
import { envToBool } from '../common/env-vars.js'
import type { Config } from '../config.js'

/**
Expand All @@ -22,7 +23,7 @@ const DEFAULT_DATA_SET_METADATA = {
* Default configuration for creating storage contexts
*/
const DEFAULT_STORAGE_CONTEXT_CONFIG = {
withCDN: false, // CDN not needed for Filecoin Pin currently
withCDN: envToBool(process.env.WITH_CDN, false),
metadata: DEFAULT_DATA_SET_METADATA,
} as const

Expand Down
Loading