docs: fix S3 examples and improve storage path visibility
- Fix 4 S3 storage configuration examples in README
- Change from 'options: {bucket}' to 's3Storage: {bucketName}'
- Enhance FileSystemStorage logs to show resolved path
- Helps users verify their configuration is working correctly
- Prevents silent failures like v3.43.2 persistence regression
This commit is contained in:
parent
09c71c398f
commit
e507fcfe06
2 changed files with 45 additions and 10 deletions
40
README.md
40
README.md
|
|
@ -543,12 +543,28 @@ await brain.import('research.pdf') // PDF with table extraction
|
|||
```javascript
|
||||
// Single node (default)
|
||||
const brain = new Brainy({
|
||||
storage: {type: 's3', options: {bucket: 'my-data'}}
|
||||
storage: {
|
||||
type: 's3',
|
||||
s3Storage: {
|
||||
bucketName: 'my-data',
|
||||
region: 'us-east-1',
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Distributed cluster - just add one flag!
|
||||
const brain = new Brainy({
|
||||
storage: {type: 's3', options: {bucket: 'my-data'}},
|
||||
storage: {
|
||||
type: 's3',
|
||||
s3Storage: {
|
||||
bucketName: 'my-data',
|
||||
region: 'us-east-1',
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
||||
}
|
||||
},
|
||||
distributed: true // That's it! Everything else is automatic
|
||||
})
|
||||
```
|
||||
|
|
@ -568,7 +584,15 @@ import { Brainy, NounType } from '@soulcraft/brainy'
|
|||
|
||||
// Ingestion nodes (optimized for writes)
|
||||
const ingestionNode = new Brainy({
|
||||
storage: {type: 's3', options: {bucket: 'social-data'}},
|
||||
storage: {
|
||||
type: 's3',
|
||||
s3Storage: {
|
||||
bucketName: 'social-data',
|
||||
region: 'us-east-1',
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
||||
}
|
||||
},
|
||||
distributed: true,
|
||||
writeOnly: true // Optimized for high-throughput writes
|
||||
})
|
||||
|
|
@ -585,7 +609,15 @@ blueskyStream.on('post', async (post) => {
|
|||
|
||||
// Search nodes (optimized for queries)
|
||||
const searchNode = new Brainy({
|
||||
storage: {type: 's3', options: {bucket: 'social-data'}},
|
||||
storage: {
|
||||
type: 's3',
|
||||
s3Storage: {
|
||||
bucketName: 'social-data',
|
||||
region: 'us-east-1',
|
||||
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
||||
}
|
||||
},
|
||||
distributed: true,
|
||||
readOnly: true // Optimized for fast queries
|
||||
})
|
||||
|
|
|
|||
|
|
@ -306,12 +306,13 @@ export async function createStorage(
|
|||
)
|
||||
return new MemoryStorage()
|
||||
}
|
||||
console.log('Using file system storage (forced)')
|
||||
const fsPath = getFileSystemPath(options)
|
||||
console.log(`Using file system storage (forced): ${fsPath}`)
|
||||
try {
|
||||
const { FileSystemStorage } = await import(
|
||||
'./adapters/fileSystemStorage.js'
|
||||
)
|
||||
return new FileSystemStorage(getFileSystemPath(options))
|
||||
return new FileSystemStorage(fsPath)
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
'Failed to load FileSystemStorage, falling back to memory storage:',
|
||||
|
|
@ -359,12 +360,13 @@ export async function createStorage(
|
|||
)
|
||||
return new MemoryStorage()
|
||||
}
|
||||
console.log('Using file system storage')
|
||||
const fsPath = getFileSystemPath(options)
|
||||
console.log(`Using file system storage: ${fsPath}`)
|
||||
try {
|
||||
const { FileSystemStorage } = await import(
|
||||
'./adapters/fileSystemStorage.js'
|
||||
)
|
||||
return new FileSystemStorage(getFileSystemPath(options))
|
||||
return new FileSystemStorage(fsPath)
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
'Failed to load FileSystemStorage, falling back to memory storage:',
|
||||
|
|
@ -538,12 +540,13 @@ export async function createStorage(
|
|||
process.versions &&
|
||||
process.versions.node
|
||||
) {
|
||||
console.log('Using file system storage (auto-detected)')
|
||||
const fsPath = getFileSystemPath(options)
|
||||
console.log(`Using file system storage (auto-detected): ${fsPath}`)
|
||||
try {
|
||||
const { FileSystemStorage } = await import(
|
||||
'./adapters/fileSystemStorage.js'
|
||||
)
|
||||
return new FileSystemStorage(getFileSystemPath(options))
|
||||
return new FileSystemStorage(fsPath)
|
||||
} catch (fsError) {
|
||||
console.warn(
|
||||
'Failed to load FileSystemStorage, falling back to memory storage:',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue