IDE Script to set SSL Port?

I have an IDE script as a build step where I want to set the SSL Port depending on the stage code. I am using PropertyValue(), but according to the docs it appears that only “Port” is available, not “SSLPort”.

Am I out of luck?

Cliff

Does it help to know that you can set the Port and SSLPort with launch arguments when you start the app?

The launch parameters override the build setting, so if you start using parameters you don’t even have to set the project properties. Because of that, I don’t happen to have an answer for your original question :grimacing:

1 Like

I did think of the launch arguments, but since this was my first time messing around with an IDE script I was hoping to accomplish everything in the script.

there are a LOT of limitations in xojo_script !

Actually… I’m constantly surprised at how powerful XojoScript is. The trick is in the context of the script. In this case, the IDE exposes a certain number of commands and properties (through PropertyValue). The methods are fairly well documented, but the properties are trickier because it just passes the string to the IDE and says “go get this”. It does a lookup and returns an empty if the property doesn’t exist.

yes I admit xojo script is very powerful. what I wanted to say is that when used to full xojo language, you have to really limit many commands if switching to xojo script

So is the consensus that there is no way to set the SSL Port in a build step?

I think you may be right, here’s what I tried:

propertyValue("App.port") = "8080"  // this works

// none of these work:

propertyValue("App.SSLPort") = "1000"
propertyValue("App.SSL Port") = "1001"
propertyValue("App.SSL.Port") = "1002"
propertyValue("App.SSL_Port") = "1003"
propertyValue("App.SecurePort") = "1004"

1 Like

I tried a couple of those property names too with no luck. I guess it’s a no-go.

The alternatives are:

  • Pass the port as an argument when launching the web app, like @Tim_Parnell mentioned
  • Set the SSL port in the Opening() event, which is what I did

I might make a feature request. I could be the only one who would ever use it, but then again I bet its a pretty easy change to make.

I’m surprised that worked. The documentation states the property is Read-Only.

Edit: I guess words mean nothing to whoever wrote the docs. It’s not Read-Only, it’s writable during Opening – against all better judgement.

TLDR:

You can’t set the SSL Port using IDE scripting

You can set the SSL Port by passing it as an argument when launching

You can, but probably shouldn’t, set the SSL Port in the Opening() event

Actually, it’s specifically allowed there. The App.Opening event fires before the http servers come up and is the last opportunity to change the value.

1 Like

In my opinion, there are better choices for setting the port. Using launch arguments allows for automation such as Lifeboat and Xojo Cloud. Setting the port in code actively prevents both from working. Also, if the port is already in use that could prevent the app from launching at all.

So, it’s doable, but personally I don’t recommend it.

I’ve made a feature request: https://tracker.xojo.com/xojoinc/xojo/-/issues/80292
Please favorite and/or add your favorite missing propertyValue property if you agree.