I have tested it on standard AppEngine with small HelloWorld modification in node.JS like this:
'use strict';
const express = require('express');
const app = express();
app.get('/', (req, res) => {
var my_respond = "variables: ";
res.status(200).send(Object.entries(process.env)).end();
});
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});
module.exports = app;
The sample is showing environment variables as result.
Than I added simplest app.yaml:
runtime: nodejs10
env_variables:
MY_VAR: "my value from app.yaml"
Than in other location I have added different yaml called app1.yaml:
runtime: nodejs12
env_variables:
MY_VAR: "my value from app1.yaml"
So this is changing node version and value of MY_VAR.
According to my tests this seems to be working little bit differently than explained in the doc, at least I understand it differently.
It's possible to use --appyaml flag, but only when there is no app.yaml file in the directory. If you do not have it in app directory, than using the flag you can point to different yaml.
So when I was trying to deploy with gcloud app deploy --appyaml="/home/vitooh/app1.yaml" and app.yaml was in application directory, the app was deployed with it - so the flag does not do anything. However when I done it without app.yaml the flag works, variable value is changed.
Actually you can spot it just after submitting command where there is a summary shown, just before you confirm deployment, in descriptor value like this:
descriptor: [/home/vitooh/app1.yaml]
source: [/home/vitooh/appEngine/nodejs-docs-samples/appengine/hello-world/standard]
target project: [xxxxx-test-01]
target service: [default]
target version: [20200819t094956]
target url: [https://xxxxx-test-01.appspot.com]
Do you want to continue (Y/n)?