mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-24 22:15:18 +00:00
Major additions: - Complete Next.js studio application with 1600+ components - Docker support (Dockerfile.combined, docker-compose.yml) - GCP deployment documentation and benchmarks - SQL benchmark scripts for performance testing - Sentry integration for monitoring - Comprehensive test suite and mocks Studio features: - Dashboard and admin interfaces - Data visualization components - Authentication and user management - API integration with RuVector backend - Static data and public assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
30 lines
887 B
TypeScript
30 lines
887 B
TypeScript
import crypto from 'crypto-js'
|
|
import { IS_PLATFORM } from 'lib/constants'
|
|
import {
|
|
ENCRYPTION_KEY,
|
|
POSTGRES_DATABASE,
|
|
POSTGRES_HOST,
|
|
POSTGRES_PASSWORD,
|
|
POSTGRES_PORT,
|
|
POSTGRES_USER_READ_WRITE,
|
|
POSTGRES_USER_READ_ONLY,
|
|
} from './constants'
|
|
|
|
/**
|
|
* Asserts that the current environment is self-hosted.
|
|
*/
|
|
export function assertSelfHosted() {
|
|
if (IS_PLATFORM) {
|
|
throw new Error('This function can only be called in self-hosted environments')
|
|
}
|
|
}
|
|
|
|
export function encryptString(stringToEncrypt: string): string {
|
|
return crypto.AES.encrypt(stringToEncrypt, ENCRYPTION_KEY).toString()
|
|
}
|
|
|
|
export function getConnectionString({ readOnly }: { readOnly: boolean }) {
|
|
const postgresUser = readOnly ? POSTGRES_USER_READ_ONLY : POSTGRES_USER_READ_WRITE
|
|
|
|
return `postgresql://${postgresUser}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}`
|
|
}
|