UrielCh / proxmox-api

TypeScript Api for proxmox
55 stars 15 forks source link

Support for No Port #16

Closed bnjunge closed 1 year ago

bnjunge commented 1 year ago

Is it possible to disable/remove the port? My Proxmox proxy doesn't have the port, just a URL.

UrielCh commented 1 year ago

if your url starts with https:// the port is 443.

your welcome.

bnjunge commented 1 year ago

I mean if the port is null, the default is 8006 which autofills. This is what I would like to disable if possible. In my case, I have my proxmox url as a domain.tld with SSL as you had mentioned. When using the API, without port the url is https://domain.tld:8006

This may need some changes here https://github.com/UrielCh/proxmox-api/blob/01cd442b13f36e0e3d04e4ac84bc6ddf040b44f8/api/src/ProxmoxEngine.ts#L128 and https://github.com/UrielCh/proxmox-api/blob/01cd442b13f36e0e3d04e4ac84bc6ddf040b44f8/api/src/ProxmoxEngine.ts#L291 just a sample.

If port could be optional that would be great for such use-cases if they arise

UrielCh commented 1 year ago

By default proxmox port is 8006, that why this is the default value, in all the cases you need a port, so it's more convenient that if you do not provide the port 8006 is provided, not 443.

maybe I do not understand your issue.

bnjunge commented 1 year ago

Well, I you're right, my request was to make the port completely optional such as const requestUrl = `${this.schema}://${this.host}/api2/json/access/ticket`; or use the .env HOST URL value together with port if one has implementations with/without PROXMOX_HOST=your_ip:port or PROXMOX_HOST=your_ip

If proxmox is behind a proxy that masks the port, or is behind a tunnel like Cloudflare ZeroTrust tunnel, support for custom ports in such a case is limited and one is only allowed to use standard http ports(80, 443)

UrielCh commented 1 year ago

Excuse me, I was on other projects.

if you can open a PR, I remember that the Proxmox API uses some strange stuff, about port, due to the usage of a PVEProxy.

I will clean your PR, if the code is dirty.

bnjunge commented 1 year ago

Done.

UrielCh commented 1 year ago

thx, I closed you PR, can you open a new one with the same title and content?

my CLA trigger was not enabled.

then your PR will be merged and the next version of the project will be published the same day.

UrielCh commented 1 year ago

By the way, you are my first Kenyan contributor, that's a pleasure 👍

bnjunge commented 1 year ago

Thank you! I have open the PR.

UrielCh commented 1 year ago

it's partially failed, you have to go back to the PR to validate the CLA. this time I can keep it.

UrielCh commented 1 year ago

up

bnjunge commented 1 year ago

Sorry was held up, will redo.

UrielCh commented 1 year ago

Note, I refactored your PR code. V 1.0.2 is out.