Defining endpoint dynamically in tabs of Apollo Server playground

I have created few tabs to show example queries on GraphQL playground. While adding tabs I need to set the endpoint/server URL as well, where the queries will be executing, actually. Below is my code:

const startServer = async () => {
  const server = new ApolloServer({
    schema,
    introspection: true,
  playground: {
    tabs: [{
        name: 'data analysis',
        endpoint: '', // want to set the server url here
        query: '{ ... }'
      }
    ]
  }
});

  server.listen(PORT);
};

I can set the hard-coded URL for production, but I don’t want to do that. I want to set it dynamically according to the environment (localhost, dev, production). Any idea how can I get production server URL dynamically to set over here. I am working in Node.js . Any help would be appreciating.