Skip to content

Commit 8f17a01

Browse files
Merge pull request #145 from Sebastian-Webster/144-add-warnings-for-using-internal-options
Add warning for internal options
2 parents a88ab17 + 40d1ee0 commit 8f17a01

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ export async function createDB(opts?: ServerOptions) {
3030
downloadRetries: 10,
3131
initSQLString: ''
3232
}
33+
34+
const suppliedOpts = opts || {};
35+
const suppliedOptsKeys = Object.keys(suppliedOpts);
36+
const internalOpts = ['_DO_NOT_USE_deleteDBAfterStopped', '_DO_NOT_USE_dbPath', '_DO_NOT_USE_binaryDirectoryPath'];
37+
38+
for (const opt of internalOpts) {
39+
if (suppliedOptsKeys.includes(opt)) {
40+
console.warn(`[ mysql-memory-server - Options WARN ]: Creating MySQL database with option ${opt}. This is considered unstable and should not be used externally. Please consider removing this option.`)
41+
}
42+
}
3343

3444
const options: InternalServerOptions = {...defaultOptions, ...opts}
3545

0 commit comments

Comments
 (0)