MCPcopy
hub / github.com/adonisjs/core / defineEnvVariables

Method defineEnvVariables

modules/ace/codemods.ts:154–168  ·  view source on GitHub ↗

* Define one or more environment variables in the .env file * * @param environmentVariables - Key-value pairs of environment variables * @param options - Configuration options * @param options.omitFromExample - Keys to exclude from .env.example file * * @example * ```ts * awa

(
    environmentVariables: T,
    options?: { omitFromExample?: Array<keyof T> }
  )

Source from the content-addressed store, hash-verified

152 * ```
153 */
154 async defineEnvVariables<T extends Record<string, number | string | boolean>>(
155 environmentVariables: T,
156 options?: { omitFromExample?: Array<keyof T> }
157 ) {
158 const editor = new EnvEditor(this.#app.appRoot)
159 await editor.load()
160
161 Object.keys(environmentVariables).forEach((key) => {
162 const value = environmentVariables[key]
163 editor.add(key, value, options?.omitFromExample?.includes(key))
164 })
165
166 await editor.save()
167 this.#cliLogger.action('update .env file').succeeded()
168 }
169
170 /**
171 * Returns the TsMorph project instance for advanced AST manipulations.

Callers 2

runMethod · 0.80
codemods.spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected