In laravel .env file we can call another variable like this ${APP_URL} . Now I uploaded my app to google cloud app engine and using app.yaml but it isn't working. Can anyone help me solve it?
-
1Just to clarify, you want to declare environment variables in the app.yaml so that the app can use them or do you want to use these variables within the app.yaml itself? – Ralemos Nov 04 '20 at 15:12
-
Yes. I want to declare APP_URL and then use it in another variable. for instance `PASSPORT_LOGIN_ENDPOINT: ${APP_URL}/oauth/token` . this syntax works in .env but not app.yaml. Is there any solution for this? – Ali Azimi Nov 05 '20 at 07:17
-
1So basically what you want is a placeholder to substitute the value of ${APP_URL}, which was previously declared in the same app.yaml, correct? If that is the case, yaml does not support placeholders natively but there are workarounds with the use of Anchors and Alias nodes, as described in this [community answer](https://stackoverflow.com/a/30410824/12857703), let me know if I understood the issue you are facing correctly so I can make this into an answer to your post. – Ralemos Nov 05 '20 at 14:39
2 Answers
As per what was discussed in the comments, I believe that what you want to do is to simply declare APP_URL
in your app.yaml to use it as a placeholder in other parts of the same app.yaml file.
The problem with that approach is that yaml does not support placeholders natively, so in order to do this you would have to use Anchors and Alias nodes as a workaround. You can find more details and also an example on those topics in this community answer.

- 5,571
- 2
- 9
- 18
-
Thank you for your effort. I have many problems deploying my app on app engine. I don't know if it good to ask it here or ask you personally – Ali Azimi Nov 07 '20 at 04:13
-
1I would say that it would be best to create a separate App Engine question for each separate problem you are facing, that way you will be able to get more help from the community. – Ralemos Nov 09 '20 at 10:18
After I wanted to deploy my Laravel app to google cloud I have faced many challenges. For example, I couldn't access static files in my public folder. That was solved with 'handlers' in app.yaml. And for my own question, we can remove .env from exclude and uploaded beside app.yaml file and it works well and this syntax '${APP_URL}' is working well. My app is a single page and it is working on Google App Engine well right now. Thanks

- 276
- 3
- 18