RaynorUE / snich

Application for code work on a ServiceNow Instance
22 stars 4 forks source link

Add support for Service Now custom URL #239

Open hrax opened 3 months ago

hrax commented 3 months ago

Is your feature request related to a problem? Please describe. When instance is configured to sit behind a proxy, VPN tunnel or the default public URL is locked, it would be amazing to be able to connect to the instance using custom URL.

Describe the solution you'd like When setting up a new instance enter custom URL in a https:// format. If the URL entered is not matching https://(.*?).service-now.com, strip protocol handler and use the whole URL as instance name.

Describe alternatives you've considered No alternatives, except manually edit already existing instance file to connect directly to the different instance using custom URL

Additional context N/A

RaynorUE commented 2 months ago

Hey there!

Please switch to the Pre-Release version of S.N.I.C.H. and it should have this functionality. If it does not, can you provide a sample URL you are using? It should allow specifying a port number as well such as https://localhost:8131 etc..

In short, the pre-release version should try and detect that you are putting in a full URL and just honor it

RaynorUE commented 2 weeks ago

Looking at this gain finally. I see what you mean now.

I'm adding logic along the following:

        const hostParts = instanceName.split('.');
        const subDomained = hostParts.length > 2;
        const isNowDotCom = enteredInstanceValue.indexOf('service-now.com');
        if(isNowDotCom){
            //behavor as folks are used to.
            instanceName = hostParts[0];
        } else if(subDomained && !isNowDotCom){
            //get all sub-domained parts from the base domain..
            hostParts.splice(hostParts.length - 2, 2);
            instanceName = hostParts.join('.');
        }