mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 08:28:22 +00:00
Add MongoDB integration and documentation updates
- Enhanced MongoDB connection handling in backend with improved host validation. - Updated documentation to include MongoDB connection options and API references. - Added new images for MongoDB connection forms and processes. - Implemented MongoDB connection form in the frontend with necessary adjustments.
This commit is contained in:
@@ -17,11 +17,19 @@ export const getMongoDBConnectionListItem = () => {
|
||||
};
|
||||
|
||||
export const validateMongoDBConnectionCredentials = async (config: TMongoDBConnectionConfig) => {
|
||||
const [hostIp] = await verifyHostInputValidity(config.credentials.host);
|
||||
let normalizedHost = config.credentials.host.trim();
|
||||
const isSrvFromHost = normalizedHost.startsWith("mongodb+srv://");
|
||||
if (isSrvFromHost) {
|
||||
normalizedHost = normalizedHost.replace(/^mongodb\+srv:\/\//, "");
|
||||
} else if (normalizedHost.startsWith("mongodb://")) {
|
||||
normalizedHost = normalizedHost.replace(/^mongodb:\/\//, "");
|
||||
}
|
||||
|
||||
const [hostIp] = await verifyHostInputValidity(normalizedHost);
|
||||
|
||||
let client: MongoClient | null = null;
|
||||
try {
|
||||
const isSrv = !config.credentials.port;
|
||||
const isSrv = !config.credentials.port || isSrvFromHost;
|
||||
const uri = isSrv ? `mongodb+srv://${hostIp}` : `mongodb://${hostIp}:${config.credentials.port}`;
|
||||
|
||||
const clientOptions: {
|
||||
|
||||
Reference in New Issue
Block a user