eluv-io / elv-live-js

Eluvio Live JavaScript SDK
MIT License
4 stars 3 forks source link

Add global option for alternate auth services URL #108

Closed elv-serban closed 1 year ago

elv-serban commented 1 year ago

There already is a --host global option as well as several command-specific instances but it doesn't work 'globally'.

There is a complication with respect to the /as prefix - in this case the --as_url command takes a URL including /as (if applicable - for local instances simply don't add /as).

elv-Loren commented 1 year ago
.option("as_url", {
    describe: "Alternate authority service URL (include '/as/' route if necessary)",
    type: "string"
  })

we are saying to include /as/ route as necessary for prod endpoints, however, we have two places that if "host" is not passed/set, we automatically prepend "/as" in TenantAuthServiceRequest, TenantPathAuthServiceRequest

    if (host !== undefined) {
      this.client.SetNodes({
        authServiceURIs:[
          host
        ]
      });
    } else {
      path = urljoin("/as", path);
    }
elv-Loren commented 1 year ago

if I remove --host option and use --as_url, it is going to prepend "/as" even if I don't want it.

elv-wayne commented 1 year ago

if I remove --host option and use --as_url, it is going to prepend "/as" even if I don't want it.

We need to test each command to make sure it works with and without the global as_url, and remove the --host params.

elv-todd commented 1 year ago

yea agreed, let's delete all instances of .option("host" ... and remove the automatic prepend of "/as" at

2531: path = urljoin("/as", path); 2580: path = urljoin("/as", path);

i'll try to make a PR tomorrow.