Home / Function/ certs() — drizzle-orm Function Reference

certs() — drizzle-orm Function Reference

Architecture documentation for the certs() function in certs.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  170d6b56_991b_37cf_700d_e3137550d5b1["certs()"]
  41aba6b6_e7c2_68d7_c84b_306b1d65e253["certs.ts"]
  170d6b56_991b_37cf_700d_e3137550d5b1 -->|defined in| 41aba6b6_e7c2_68d7_c84b_306b1d65e253
  4989a948_cacf_e4b2_7283_c9335d2b7983["startServerFromSetup()"]
  4989a948_cacf_e4b2_7283_c9335d2b7983 -->|calls| 170d6b56_991b_37cf_700d_e3137550d5b1
  72630e5c_93c3_75d3_29f3_af0928ebe15c["studio.handler()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| 170d6b56_991b_37cf_700d_e3137550d5b1
  f5b03b7c_27d9_62a3_234c_88bd5c67d96c["runCommand()"]
  170d6b56_991b_37cf_700d_e3137550d5b1 -->|calls| f5b03b7c_27d9_62a3_234c_88bd5c67d96c
  style 170d6b56_991b_37cf_700d_e3137550d5b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/utils/certs.ts lines 15–44

export const certs = async () => {
	const res = await runCommand('mkcert --help');

	if (res.exitCode === 0) {
		const p = envPaths('drizzle-studio', {
			suffix: '',
		});

		// create ~/.local/share/drizzle-studio
		mkdirSync(p.data, { recursive: true });

		// ~/.local/share/drizzle-studio
		const keyPath = join(p.data, 'localhost-key.pem');
		const certPath = join(p.data, 'localhost.pem');

		try {
			// check if the files exist
			await Promise.all([access(keyPath), access(certPath)]);
		} catch (e) {
			// if not create them
			await runCommand(`mkcert localhost`, { cwd: p.data });
		}
		const [key, cert] = await Promise.all([
			readFile(keyPath, { encoding: 'utf-8' }),
			readFile(certPath, { encoding: 'utf-8' }),
		]);
		return key && cert ? { key, cert } : null;
	}
	return null;
};

Domain

Subdomains

Calls

Frequently Asked Questions

What does certs() do?
certs() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/utils/certs.ts.
Where is certs() defined?
certs() is defined in drizzle-kit/src/utils/certs.ts at line 15.
What does certs() call?
certs() calls 1 function(s): runCommand.
What calls certs()?
certs() is called by 2 function(s): startServerFromSetup, studio.handler.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free