|
1 | 1 | import { handleMcp } from './handle-mcp.mts' |
| 2 | +import { getMcpHttpMode } from '../../env/mcp-http-mode.mts' |
| 3 | +import { getMcpPort } from '../../env/mcp-port.mts' |
| 4 | +import { getSocketOauthIntrospectionClientId } from '../../env/socket-oauth-introspection-client-id.mts' |
| 5 | +import { getSocketOauthIntrospectionClientSecret } from '../../env/socket-oauth-introspection-client-secret.mts' |
| 6 | +import { getSocketOauthIssuer } from '../../env/socket-oauth-issuer.mts' |
| 7 | +import { getSocketOauthRequiredScopes } from '../../env/socket-oauth-required-scopes.mts' |
| 8 | +import { getTrustProxy } from '../../env/trust-proxy.mts' |
2 | 9 | import { commonFlags } from '../../flags.mts' |
3 | 10 | import { defineFlags } from '../../meow.mts' |
4 | 11 | import { meowOrExit } from '../../utils/cli/with-subcommands.mjs' |
@@ -130,38 +137,31 @@ export async function run( |
130 | 137 | parentName, |
131 | 138 | }) |
132 | 139 |
|
133 | | - const envHttp = process.env['MCP_HTTP_MODE'] === 'true' |
134 | | - const http = cli.flags.http || envHttp |
| 140 | + const http = cli.flags.http || getMcpHttpMode() |
135 | 141 |
|
136 | 142 | const portFlag = cli.flags.port |
137 | 143 | const portRaw = |
138 | 144 | portFlag && portFlag > 0 |
139 | 145 | ? portFlag |
140 | | - : Number.parseInt(process.env['MCP_PORT'] || `${DEFAULT_PORT}`, 10) |
| 146 | + : Number.parseInt(getMcpPort() || `${DEFAULT_PORT}`, 10) |
141 | 147 | const port = Number.isFinite(portRaw) && portRaw > 0 ? portRaw : DEFAULT_PORT |
142 | 148 |
|
143 | | - const oauthIssuer = |
144 | | - cli.flags['oauth-issuer'] || |
145 | | - process.env['SOCKET_OAUTH_ISSUER'] || |
146 | | - '' |
| 149 | + const oauthIssuer = cli.flags['oauth-issuer'] || getSocketOauthIssuer() || '' |
147 | 150 | const oauthClientId = |
148 | 151 | cli.flags['oauth-client-id'] || |
149 | | - process.env['SOCKET_OAUTH_INTROSPECTION_CLIENT_ID'] || |
| 152 | + getSocketOauthIntrospectionClientId() || |
150 | 153 | '' |
151 | 154 | const oauthClientSecret = |
152 | 155 | cli.flags['oauth-client-secret'] || |
153 | | - process.env['SOCKET_OAUTH_INTROSPECTION_CLIENT_SECRET'] || |
| 156 | + getSocketOauthIntrospectionClientSecret() || |
154 | 157 | '' |
155 | 158 | const oauthRequiredScopesRaw = |
156 | | - cli.flags['oauth-required-scopes'] || |
157 | | - process.env['SOCKET_OAUTH_REQUIRED_SCOPES'] || |
158 | | - '' |
| 159 | + cli.flags['oauth-required-scopes'] || getSocketOauthRequiredScopes() || '' |
159 | 160 | const oauthRequiredScopes = oauthRequiredScopesRaw |
160 | 161 | ? parseRequiredScopes(oauthRequiredScopesRaw) |
161 | 162 | : undefined |
162 | 163 |
|
163 | | - const trustProxy = |
164 | | - cli.flags['trust-proxy'] || process.env['TRUST_PROXY'] === 'true' |
| 164 | + const trustProxy = cli.flags['trust-proxy'] || getTrustProxy() |
165 | 165 |
|
166 | 166 | await handleMcp({ |
167 | 167 | http, |
|
0 commit comments