@@ -2,7 +2,6 @@ import { HttpLibrary, HttpConfiguration, RequestContext, ZstdCompressorCallback
2
2
import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch";
3
3
import { BaseServerConfiguration, server1, servers, operationServers } from "./servers";
4
4
import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth";
5
- import { isNode } from "./util";
6
5
7
6
export interface Configuration {
8
7
readonly baseServer?: BaseServerConfiguration;
@@ -69,7 +68,7 @@ export interface ConfigurationParameters {
69
68
* @param conf partial configuration
70
69
*/
71
70
export function createConfiguration(conf: ConfigurationParameters = {}): Configuration {
72
- if (isNode && process.env.DD_SITE) {
71
+ if (typeof process !== "undefined" && process.env && process.env.DD_SITE) {
73
72
const serverConf = server1.getConfiguration();
74
73
server1.setVariables({"site": process.env.DD_SITE} as (typeof serverConf));
75
74
for (const op in operationServers) {
@@ -80,7 +79,7 @@ export function createConfiguration(conf: ConfigurationParameters = {}): Configu
80
79
const authMethods = conf.authMethods || {};
81
80
{% - for name , schema in openapi .components .securitySchemes .items () %}
82
81
{% - if schema .get ("type" ) == "apiKey" and schema .get ("in" ) == "header" %}
83
- if (!("{{ name }}" in authMethods) && isNode && process.env.{{ schema["x-env-name"] }}) {
82
+ if (!("{{ name }}" in authMethods) && typeof process !== "undefined" && process.env && process.env.{{ schema["x-env-name"] }}) {
84
83
authMethods["{{ name }}"] = process.env.{{ schema["x-env-name"] }};
85
84
}
86
85
{% - endif %}
0 commit comments