caprover / caprover-cli

Command Line Interface for https://github.com/caprover/caprover
72 stars 39 forks source link

New parameter -s to diferente "captain" sub-domain #113

Closed joseviniciusnunes closed 2 years ago

joseviniciusnunes commented 2 years ago

Hey guys,

Thank you all for the excellent platform.

I made some adjustments to adapt the cli to the caprover's "captainSubDomain" parameter: /captain/data/config-override.json

{"captainSubDomain":"admin"}

The option already exists on the platform but the cli always requires the use of "captain", in my case my captain servers are like "node1", "node2", "node3", etc....

This is bothering me because I can't use the cli in a CI CD environment.

I created an additional parameter -s, example

npx caprover deploy -h mydomain.com -s node1 -p 123456 -a app-test -i my-image
githubsaturn commented 2 years ago

Hi @joseviniciusnunes ! Thanks for the PR, but this complexity wasn't actually needed... Probably you can just override the variable in constants file. Something like this would work and it's much cleaner


-- const ADMIN_DOMAIN = 'captain'
++ const ADMIN_DOMAIN = process.env.CAPROVER_ADMIN_DOMAIN_OVERRIDE || 'captain' 
2 | const SAMPLE_DOMAIN = `${ADMIN_DOMAIN}.captainroot.yourdomain.com`
… |  
8 | const BASE_API_PATH = '/api/v2'
9 | const API_METHODS = ['GET', 'POST']
10
joseviniciusnunes commented 2 years ago

Hi @githubsaturn

I thought exactly this way, but it came to my mind that it would be out of the CLI standard 🙃 hehe But the solution is also very good.

Can I upload a new PR with your suggestion?