[PLEASE, DELETE IT] Trigger list of pipelines through the API

Question about CI and Triggering pipelines through the API

I have core module and a bunch of services (let’s say 20).
Services depends from core and they need to be rebuild each time core is changed.

Task:
each time pipeline runs on core module it should trigger pipeline on each services.

It can be done with API, we can just add this line to our core pipeline:
script:
- curl --request POST --form token=$API_TOKEN_SERVICES1 --form ref=demo $SERVICES1

Where $API_TOKEN_SERVICES1 stores in core projects Environment variables,
and $SERVICES1 are URL to service #1.

Problem:
I don’t want to list all the URL services in .gitlab-ci.yml, I want different file with list of this services.
I tried to use bash script with 20 lines of
curl --request POST --form token=$API_TOKEN_SERVICES1 --form ref=demo $SERVICES1...
But problem is that bash script doesn’t catch $API_TOKEN_SERVICES1 variable (because it stores in projects environment variables).
I also can’t store API_TOKENS in files because it is not secure.

What I want to achieve:

  1. In core project I need pipeline which will trigger list of pipeline services.
  2. List of this services should be on different file, not in .gitlab-ci.yml

How can I achieve this?

Thank you for your help.