Description
In metacall-deploy, the --serverUrl (-u) CLI flag is parsed but applied to the internal configuration after the api client has been initialized. As a result, the provided custom URL is completely ignored during the execution of deployment commands.
The API client falls back to the default baseURL (e.g., https://api.metacall.io or the cached config). Currently, the only way to override the target URL locally is by using the hardcoded --dev flag, which always sets the target to localhost:9000.
Steps to Reproduce
- Execute
metacall-deploy using a custom --serverUrl, for example:
metacall-deploy --serverUrl http://custom-faas-server.local:9000 --workdir .
- Observe the network traffic or CLI output. The CLI connects to the default API (
https://api.metacall.io) instead of the specified custom URL.
Expected Behavior
The API client should instantiate using the base URL provided via the --serverUrl parameter, allowing deployments to a custom self-hosted or remote FaaS instance.
Actual Behavior
The API client instantiates using the default configuration, and the --serverUrl parameter is applied to the script's config state at the very end of index.ts, well after the API client has been utilized.
Root Cause
In deploy/src/index.ts, the api object is initialized with config.baseURL:
However, the override from the CLI arguments is only checked at the end of the script line 178:
if (args['serverUrl']) {
config.baseURL = args['serverUrl'];
}
})();
Proposed Fix
Apply the configuration override before initializing the API client:
const config = await startup(args['confDir']);
// Fix: Apply --serverUrl override before API client creation
if (args['serverUrl']) {
config.baseURL = args['serverUrl'];
}
const api: APIInterface = API(
config.token as string,
args['dev'] ? config.devURL : config.baseURL
);
I'm willing to resolve this issue.
Note: The --dev flag should be removed in the future.
Description
In
metacall-deploy, the--serverUrl(-u) CLI flag is parsed but applied to the internal configuration after theapiclient has been initialized. As a result, the provided custom URL is completely ignored during the execution of deployment commands.The API client falls back to the default
baseURL(e.g.,https://api.metacall.ioor the cached config). Currently, the only way to override the target URL locally is by using the hardcoded--devflag, which always sets the target tolocalhost:9000.Steps to Reproduce
metacall-deployusing a custom--serverUrl, for example:metacall-deploy --serverUrl http://custom-faas-server.local:9000 --workdir .https://api.metacall.io) instead of the specified custom URL.Expected Behavior
The API client should instantiate using the base URL provided via the
--serverUrlparameter, allowing deployments to a custom self-hosted or remote FaaS instance.Actual Behavior
The API client instantiates using the default configuration, and the
--serverUrlparameter is applied to the script'sconfigstate at the very end ofindex.ts, well after the API client has been utilized.Root Cause
In
deploy/src/index.ts, theapiobject is initialized withconfig.baseURL:However, the override from the CLI arguments is only checked at the end of the script line 178:
Proposed Fix
Apply the configuration override before initializing the API client:
I'm willing to resolve this issue.
Note: The
--devflag should be removed in the future.