custom build command per environment

Is it possible to define a custom build command for an Angular app based on the environment? I need to trigger different npm scripts depending on the railway "ng build --configuration railway "ng build --configuration railway-staging",
16 Replies
Percy
Percy13mo ago
Project ID: d17c573a-a1a2-404c-8095-3e38320f6362
Dynamic Reel
Dynamic ReelOP13mo ago
d17c573a-a1a2-404c-8095-3e38320f6362
Brody
Brody13mo ago
use an environment variable for the configuration value
Dynamic Reel
Dynamic ReelOP13mo ago
That cannot be done in the package.json in the Angulatr project, can it? Also I am not using Dockerfile. And Angular cannot access environment variables for build, can it?
Brody
Brody13mo ago
you can change the scripts in the package.json to use an environment variable, then set the appropriate service variable in the service settings
Dynamic Reel
Dynamic ReelOP13mo ago
That is awesome! I didn’t know you could do that. Thank you so much.
Brody
Brody13mo ago
no problem! where you able to get a working implementation?
Dynamic Reel
Dynamic ReelOP13mo ago
Yes. I now have independent development and staging environments
Brody
Brody13mo ago
awesome, would you care to share examples for anyone reading in the future?
Dynamic Reel
Dynamic ReelOP13mo ago
Sure. How would I do that?
Brody
Brody13mo ago
just send examples of your start commands and such
Dynamic Reel
Dynamic ReelOP13mo ago
Right here in our chat?
Brody
Brody13mo ago
yes of course use triple backticks for code blocks
Dynamic Reel
Dynamic ReelOP13mo ago
Alright, will do Thanks again. May I ask you: Are you actually a bot? You answered so quickly
Brody
Brody13mo ago
I'm not a bot, was already on my phone with discord open and you asked an easy question so I just answered
Dynamic Reel
Dynamic ReelOP13mo ago
😅
Want results from more Discord servers?
Add your server