What's the correct way to handle "per stage" changes?

I’ve reviewed the thread on stage variables and how the plan is to replace them with env variables. But I still don’t understand the recommended approach to the following…

I have a function which needs to point to a different database IP address depending on what stage it’s in. How do I accomplish this?

So there’s code in my function like…
var client = new cassandra.Client({ contactPoints: [event.stageVariables.CassandraIP], keyspace: event.stageVariables.Keyspace })

What do I replace this with, or how do I reconstruct this, so that it works with serverless (both today, and in the future)?

You need to have some kind of variable support - currently there’s no built-in way to do this in Serverless, but I suspect this will change very soon.

As a work-around, you can use the this plugin and create per-stage variables for the value you want to set.

Edit: Checkout @str3tch’s excellent response in this thread.

Thank you very much.