<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Davut Gürbüz on Medium]]></title>
        <description><![CDATA[Stories by Davut Gürbüz on Medium]]></description>
        <link>https://medium.com/@davutgurbuz?source=rss-85bbdab7fc8f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GMqj4QP-gzBOj6-g.</url>
            <title>Stories by Davut Gürbüz on Medium</title>
            <link>https://medium.com/@davutgurbuz?source=rss-85bbdab7fc8f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 17:52:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@davutgurbuz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Google Recaptcha implementation within minutes in your Angular project]]></title>
            <link>https://davutgurbuz.medium.com/google-recaptcha-implementation-within-minutes-for-angular-developers-ca4cb5a1e3cc?source=rss-85bbdab7fc8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca4cb5a1e3cc</guid>
            <category><![CDATA[captcha]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Davut Gürbüz]]></dc:creator>
            <pubDate>Wed, 10 Aug 2022 10:21:54 GMT</pubDate>
            <atom:updated>2022-08-11T08:30:14.847Z</atom:updated>
            <content:encoded><![CDATA[<p>If you haven’t tried Google’s captcha service yet, let’s see how we can implement it within minutes using <a href="https://www.npmjs.com/package/ngx-captcha">ngx-recaptcha</a> in an angular project.</p><p><strong>Step 1 -Get a Google captcha key</strong></p><p>We need to visit below address and fill the form as seen below. Domain name addresses are important if you would like to restrict your captcha for certain domains. i.e. <em>localhost</em>, yoursite.com, yourtestenv.local.. you shall enter without the schema.</p><p>You may also set the difficulty and other options online.</p><p><a href="https://www.google.com/recaptcha/admin/create">https://www.google.com/recaptcha/admin/create</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*xLItcbNKT7b9UICtHHSnqw.png" /></figure><p><strong>Step 2 -Install Captcha into your Angular App</strong></p><p>You may use ngx-captcha and follow its official guide at <a href="https://www.npmjs.com/package/ngx-captcha">https://www.npmjs.com/package/ngx-captcha</a>. Just as an example, I’ll demonstrate my use case here below . Then, you may enhance it to protect your application from <a href="https://en.wikipedia.org/wiki/Brute-force_attack">brute force attacks </a>by developing your own strategy.</p><pre>npm install ngx-captcha</pre><p>After installation make sure you’ve `<em>NgxCaptchaModule</em>` under `<em>app.module.ts</em>` imports.</p><p><strong>Step 3- Develop a strategy to display the captcha</strong></p><p>Adding below code to your `form group` will show captcha by default, but solving `I’m not-a-robot` problems at every login attempt can be annoying after some time.</p><pre>// this will immediately make captcha as required<br>recaptcha: [‘’, Validators.required]</pre><p>So, the implementation below is designed to show it after a login failure. You can also consider using `<a href="https://angular.io/api/forms/FormArray">FormArray API</a>` in order to add form elements dynamically. However, I believe my implementation is simpler for this demo use case.</p><pre>//your login.component.ts </pre><pre>//We&#39;ll use this reference to enable captcha later<br>@ViewChild(&#39;captchaElem&#39;, { static: false }) captchaElem: ReCaptcha2Component;</pre><pre>// kepcheHidden variable will help us to hide/view captcha control<br>kepceHidden:boolean=true;</pre><pre>siteKey:any=&quot;siteKey_you_got_from_google&quot;;</pre><pre>ngOnInit() {</pre><pre>this.loginForm = this.formBuilder.group({</pre><pre>username: [‘’, Validators.required],<br>password: [‘’, Validators.required],<br>recaptcha: this.formBuilder.control(‘’)</pre><pre>});</pre><pre>//your login.component.html, under form group elements</pre><pre>&lt;div class=”form-group “&gt;<br>&lt;ngx-recaptcha2 #captchaElem [hidden]=”kepceHidden”<br> [siteKey]=”siteKey”<br> [useGlobalDomain]=”false”<br> formControlName=”recaptcha”&gt;<br>&lt;/ngx-recaptcha2&gt;<br>&lt;/div&gt;</pre><p>After having the initial setup and UI, we can enable it after an unsuccessful login attempt and refresh the captcha for each login failure.</p><pre>// Where you&#39;re handling a failing attempt.<br>if(status==&#39;401&#39;){</pre><pre>this.error = ‘Username or Password do not match.’;<br>this.kepceHidden=false;<br>//get a reference of captcha form control using `get` or @ViewChild<br>this.loginForm.get(‘recaptcha’).setValidators(Validators.required);<br>this.captchaElem.resetCaptcha();</pre><pre>}</pre><p>Enjoy it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca4cb5a1e3cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A simple HTTP/HTTP(S) reverse proxy with NodeJS]]></title>
            <link>https://davutgurbuz.medium.com/a-simple-http-http-s-reverse-proxy-with-nodejs-8c0976f48f46?source=rss-85bbdab7fc8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c0976f48f46</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[proxy]]></category>
            <dc:creator><![CDATA[Davut Gürbüz]]></dc:creator>
            <pubDate>Sat, 20 Mar 2021 21:48:12 GMT</pubDate>
            <atom:updated>2021-03-22T07:52:30.387Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ps5X0XNagS_nDf3a" /><figcaption>Photo by <a href="https://unsplash.com/@kovacsz1?utm_source=medium&amp;utm_medium=referral">Z S</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Who is this write up for ?</strong><br>Anyone who needs to make secure http(s) calls behind the scene easily. If you need to communicate with a SSL <strong>s</strong>ecured endpoint for some reason you might find this useful in your solution.</p><p><strong>A sample use case</strong></p><p>Let me share you my story in short why I appealed this use. The open source middleware we have been using in the corp has a commercial extension for submitting anything to http(s) endpoints. Even though I’ve <a href="https://github.com/CSCONNECT/connect">forked </a>the project and made it possible to use http(s) without that commercial extension, using a proxy was seen as an out of the box workaround to us.</p><figure><img alt="Reverse Proxy" src="https://cdn-images-1.medium.com/max/1024/1*ak9ohy76WmoSdfqHprn9GA.png" /><figcaption>An ordinary use of proxy for security</figcaption></figure><p><strong>See how simple it’s yourself.</strong></p><pre>var httpProxy = require(‘http-proxy’);<br>var fs = require(‘fs’);</pre><pre>httpProxy.createProxyServer({<br> target: {<br> protocol: ‘http<strong>s</strong>:’,<br> <strong>host</strong>: ‘ubersecure.bank.com.tr’,<br> port: 443,<br> pfx: fs.readFileSync(‘yourpfx.p12’),<br> passphrase: ‘your_uber_secure_password’,<br> },<br> changeOrigin: true,<br>}).<strong>listen</strong>(8000);</pre><p>It’s that much simple !</p><p>This program listens on port 8000 and forward any request to the target destination you mentioned as a parameter. There are also more parameters provided by the project you <em>will </em>need in the production.</p><p>I recommend you to have a look at timeout, proxyTimeout , headers …parameters from the <a href="https://github.com/chimurai/http-proxy-middleware">project page</a> based on your possible needs.</p><p>You don’t need to be a nodejs expert to make this run.<br> — Just i<a href="https://nodejs.org/en/download/">nstall nodejs</a> into your environment. <br> — run &gt;npm init (just to create package.json),and add http-proxy as a dependency. <br>— run &gt;npm install to install node module dependencies and save above code as program.js<br>— run your program with &gt; node program.js</p><p><strong>Conclusion</strong></p><p>These a few lines of code address a lot of concerns in deed. We can hide the actual target destination from the first client which is trying to access a top secure resource. The final SSL Secured server which allows requests coming from a specific IP/domain and our this little proxy program can reside there. We’re opening a door with this proxy, however we’re defining the rules of access and hiding the actual destination from the first requester.</p><p>We can also deploy many copies from this little service for load balancing and put it behind another proxy like nginx, or a gateway like Zuul, Spring Cloud Gateway.</p><p><strong>More about Proxy</strong></p><p>The most broad term proxy is an important topic to be understood by architects, developers and many other IT techies. There are terms like forward proxy, reverse proxy, Gateway , VPN . These are not all mutually exclusive things since gateway and VPN can be also considered as proxies. The naming convention in your org can cause people use their own dictionaries and this leads misconceptions among people. I prefer saying MIM within the team. Each of these things are actually a man-in-the-middle and solves different sort of concerns. There is of course a subtle but utmost important differences among these things.</p><p>In a nutshell,<br>A forward proxy is what we have in our organizations mosty, school or work organization proxies. To reach internet client goes through a proxy server. This usually impact performance badly.<em> (I always hate this sort of proxies)</em></p><p>A reverse proxy is the one client reaches an interface server, actual <em>origin server</em> is accessed by this proxy server at server end and the response is delivered back to the requesting client. Since all these happen on server end, it’s mostly used for security and load balancing purposes. A Gateway is a specific form of this proxy. We usually hear API Gateway more often. In microservices architecture API’s are being forwarded to services based on API paths most of the time.</p><p>A VPN is a Virtual Private Network can be also counted as a proxy since <em>any request</em> we make go through an <em>encrypted</em> proxy call to a destination address. Destination knows the VPN proxy, not the original requester. It’s mostly preferred for hiding the identity of internet user and in order to access government blocked pages. People obtain anonymity and post their thoughts freely with less internet traceability. Paid VPNs are recommended for performance and privacy since they claim there is no activity log once you enroll.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c0976f48f46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Java classes from JSON dynamically.]]></title>
            <link>https://davutgurbuz.medium.com/the-need-history-c91c9d38ec9?source=rss-85bbdab7fc8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c91c9d38ec9</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[converter]]></category>
            <category><![CDATA[java8]]></category>
            <dc:creator><![CDATA[Davut Gürbüz]]></dc:creator>
            <pubDate>Sat, 09 May 2020 12:33:23 GMT</pubDate>
            <atom:updated>2020-06-01T13:17:25.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Creating Java classed from JSON dynamically." src="https://cdn-images-1.medium.com/max/540/1*MnQ1_FeOBHwRWuwUpyND9Q.png" /><figcaption>Creating Java classes from JSON dynamically.</figcaption></figure><p><strong>The need,history…<br></strong>We were designing a new microservice recently and decided to try a new approach instead of using <em>a shared lib</em> for data structures we use commonly. As you know from many projects, some interfaces and classes are being shared as proxy classes mostly with a naming convention as <em>shared.jar/sharedlib</em>… and similar. DTOs (Data Transfer Objects) are typical examples.</p><p>It’s <a href="https://phauer.com/2016/dont-share-libraries-among-microservices/">another discussion in DDD </a>(Domain Driven Design) having shared libs, but it’s also an undeniable fact as we need shared things at intersections, and it’s acceptable in some level. Duplication is an option but we thought we could generate the classes dynamically for our service. I admit it’s not possible or the best practice for all projects but it’s an exact cut for our need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Ns7aSpEpPOrsdgPuGx8WWA.png" /><figcaption>a shared lib</figcaption></figure><p>Shared libs could be a bit troublesome for this particular mircoservice. Possible changes in proxy libs needs to be versioned and for every release there must be a concord among all. Moreover, we really wished this micro-service be able to serve to any other service or app written in any language, working with any data-set...</p><p><strong>An idea, one solution..</strong></p><p>REST API is a standard for almost all apps today, and it can be implemented in different serialization ways.However, we also see that JSON is the most common format community preferred. So, if we can convert JSON serialized objects to Java classes dynamically. This might help us in our problem.</p><p>Let’s try,</p><p>There are libraries serializing JSON objects to <em>known classes</em> in many programming languages, jackson is the dominant one in Java and JSON.NET is the popular one in .net stack.</p><p>There are even some websites converting JSON to Java or C# online. If you check these sites, you’ll figure out they create java classes either from <a href="http://www.jsonschema2pojo.org/">a backend service</a> or by using <a href="https://codebeautify.org/json-to-java-converter">javascript directly</a>. In both cases there is only string manipulation… That is it. Why can’t we do the same !</p><p>The solution is quite simple then, we can create the java source code, compile it on the fly and add it into JVM context. Of course we’ll need a custom class loader, a compiler app and a little reflection trick. After all, there is no need to share a sharedlib.jar, but instead the json serialized class will be converted to java source and define our class structure dynamically. In short, {<em>JSON Obj} -&gt; className.java -&gt; className.class.</em></p><p>If you check <em>json to java source converting websites</em> you see that you need to enter <em>package name </em>and <em>class name </em>for your class generation. <em>Import namespace </em>and <em>class name called </em>for the .net world. As we all know, Java Script Object Notation <em>doesn’t </em>give us any class name. We map it to our <em>known classes. So, what will be our className ?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*Ms0pzSUlZuDIkYkBpKNduQ.png" /><figcaption>a typical JSON</figcaption></figure><p>From the beginning we designed our base objects <em>self descriptive. </em>We have <em>className</em> attribute in our base object and its value is always the full name of the class.</p><p>{ <strong>className</strong>:”com.medium.write.up”}</p><p>You got the idea, we always have the package name and class name with this base attribute for all objects in our environment already. It’s basically <em>self descriptive</em> . You can improve it with class version to support versioning based on your need.</p><p>Our Dynamic Java Source Map finally looked like this thing below. A source code object and its composite nested members. Source code is a map, because it can refer to other classes and they can refer to others and so on. The limitation here is any member must have <em>self descriptive </em>attribute (here className) or must be an already known type by JVM<em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*WFKqAVmE8QwKWRwl5De5cA.png" /><figcaption>Dynamic Java Source Map</figcaption></figure><p>Another important point is you need to start from the deepest node to start creating <strong><em>unknown objects</em></strong> dynamically in your environment and make sure it’s not generated and added to your JVM environment <em>before</em>. To achieve that we need a thread safe object map to store class name and class object pairs.</p><p>Precisely <strong>Map&lt;String, javax.tools.SimpleJavaFileObject&gt;.</strong></p><p>If our className is in this map we instantiate from it otherwise we generate required class and go to upper levels in the node tree to generate the desired root object.</p><p><strong>LIMITATION, JDK,..</strong></p><p>Since we dynamically build java sources into classes we need <strong>javac</strong> java compiler. It comes with JDK, but not JRE. So, we need to run this app with JDK. Otherwise the classLoaders we use and the things written under interfaces won’t reach to concrete classes and we’ll face the most famous <em>NullPointerException</em>. This means there is also proxy between JRE and JDK. So, Just run it with a JDK. You will see that it works! I don’t mean it’s not compiling with JRE, it’s compiling in both cases but runs with JDK !</p><p>Don’t forget to put <strong>className </strong>attribute for every object in your JSON, including nested objects.</p><p><strong>Example JSON,</strong></p><p>Here we have <strong>a.b.c.DynaClass, </strong>has nested object <strong>a.b.c.NestedClass,</strong> and that has 3 other sub objects.</p><p>Our project needs to create <strong>NestedClassFoo,NestedClassBar an NestedClassBaz </strong>at first place. Because <strong>NestedClass</strong> depends on them, then <strong>NestedClass</strong> and finally <strong>DynaClass</strong> will be generated. While using a recursive function we need to ensure any reference is not duplicating in the JVM. Because one of the member can be referenced in different classes.</p><blockquote>{<br> “type”:”object”,<br> “className”:”a.b.c.DynaClass”,<br> “properties”:{<br> “className”:”a.b.c.NestedClass”,<br> “foo”:{<br> “className”:”a.b.c.NestedClassFoo”,<br> “var1”:”string”<br> },<br> “bar”:{<br> “className”:”a.b.c.NestedClassBar”,<br> “var2”:”integer”<br> },<br> “baz”:{<br> “className”:”a.b.c.NestedClassBaz”,<br> “var3”:”boolean”<br> }<br> }<br>}</blockquote><p><strong>Test Flight,</strong></p><p>Here is the open source page of the project, give it a try.</p><p>It’s a <em>SpringBoot project</em>. You can either post above JSON to your <a href="http://localhost:9090/json2java/json"><em>http://localhost:9090/json2java/json</em></a><em> </em>endpoint or simply run the <em>JUnit test case </em>to see how JSON turn to java source and be compiled to a class in the runtime.</p><p>Looking forward for your pull requests as well,</p><p><a href="https://github.com/CSCONNECT/json2java">CSCONNECT/json2java</a></p><p><em>P.S. Don’t forget to run with JDK and never miss className attribs for objects ;)</em></p><p>Happy coding !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c91c9d38ec9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is it a good deployment practice to rely on Env files for Angular2+]]></title>
            <link>https://davutgurbuz.medium.com/is-it-a-good-deployment-practice-to-rely-on-env-files-for-angular2-810b89e6a501?source=rss-85bbdab7fc8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/810b89e6a501</guid>
            <category><![CDATA[devops-practice]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Davut Gürbüz]]></dc:creator>
            <pubDate>Sun, 01 Mar 2020 09:30:23 GMT</pubDate>
            <atom:updated>2020-03-02T14:32:00.100Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Is it a good deployment practice to rely on Env files for Angular2+ ?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g6AY5SlTLUnhgDu8" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>No doubt all Angular2+ developer know about different environments dev,prod,,,,myEnv environments. Official documentation encourage developers to follow a practice to compile code for different environments.</p><p>see official doc at <a href="https://angular.io/guide/build">https://angular.io/guide/build</a></p><blockquote>└──myProject/src/environments/<br> └──environment.ts<br> └──environment.prod.ts<br> └──environment.stage.ts</blockquote><p>Having env.ts as a typescript file has a clear, dynamic modification advantage since you can have programming functionality in it and it’s not a static file. However, angular cli will compile it and embed everything into your minified and uglified code. This is not something we really demand in DevOps in general. Especially if you have several environments.</p><p>If we need to illustrate, for any little change you need to compile again N times. Because your config will be minified and uglified and be part of your deliverable.</p><blockquote>ng build — prodSite1<br>,,,<br>ng build — prodSiteN</blockquote><p>Here is my solution for this hassle. I hope this helps others and I’m looking forward to hearing from all the community to learn better practices.</p><p>First of all, I decided to use a simple json file, not to take environment files in my compilation execution. I places an env.json file under assets as seen below.</p><p><em>assets/env.json</em></p><blockquote>{<br>“baseUrl” : “http://10.10.10.dev/&quot;,<br>“socketUrl”: “ws://10.10.10.dev/”,<br>“tokenUrl”: “http://10.10.10.dev/&quot;<br>}</blockquote><p>and an Env class representing this JSON configuration.</p><pre>export class Env {<br>   baseUrl:any;<br>   socketUrl:any;<br>   tokenUrl:any;<br>}</pre><p>coded <strong>AppInitService </strong>to utilize from env.json.</p><pre>import { Injectable } from ‘@angular/core’;</pre><pre>import { HttpClient } from ‘@angular/common/http’;</pre><pre>import { Env } from ‘src/Env’;</pre><pre>@Injectable()</pre><pre>export class AppInitService {</pre><pre>public env:Env;</pre><pre>constructor(private http:HttpClient) {</pre><pre>}</pre><pre>Init():Promise&lt;Env&gt; {</pre><pre>return new Promise&lt;Env&gt;((resolve, reject) =&gt; {</pre><pre>////do your initialization stuff here</pre><pre>var resolveResult=null;</pre><pre>return this.http.get&lt;Env&gt;(‘assets/env.json’).subscribe((val)=&gt;{</pre><pre>this.env=val;</pre><pre>if(!this.env || !this.env.baseUrl)</pre><pre>this.initDefaults();</pre><pre>resolveResult=this.env;</pre><pre>//resolve();</pre><pre>},err=&gt;{</pre><pre>this.initDefaults();</pre><pre>console.error(err);</pre><pre>resolveResult=err;</pre><pre>},()=&gt;{</pre><pre>resolve(resolveResult);</pre><pre>})</pre><pre>});</pre><pre>}</pre><pre>initDefaults(){</pre><pre>this.env=new Env();</pre><pre>this.env.baseUrl= window.location.protocol+”//”+window.location.host+”/” ;</pre><pre>this.env.socketUrl=’ws://’+window.location.host+’/’;</pre><pre>this.env.tokenUrl=this.env.tokenUrl;</pre><pre>}</pre><pre>}</pre><p>After placing this service to our <strong>app.module.ts</strong> as following it’ll be ready to use.</p><pre><strong>app.module.ts</strong></pre><pre><strong>import { AppInitService } from &#39;./applicationSettings/app-init.service&#39;;</strong></pre><pre>export function initializeApp(appInitService: AppInitService) {</pre><pre>return (): Promise&lt;Env&gt; =&gt; {</pre><pre>return appInitService.Init();</pre><pre>}</pre><pre>}</pre><pre>export function initializeScopeService(appInitService: AppInitService,scopeService: ScopeService) {</pre><pre>return ():Promise&lt;any&gt; =&gt;{</pre><pre>return appInitService.Init().then(()=&gt;{return scopeService.Init();})</pre><pre>}</pre><pre><strong>providers: [</strong></pre><pre><strong>AppInitService,</strong></pre><pre><strong>,,,]</strong></pre><pre>}</pre><p>This is how we use it in our <strong>components or services</strong>. Please notice we are giving AppInitService as a dependency to XYZ service. So, it will depend on AppInitService. In another word AppInitService will be created and injected first. Use in components is quite similar.</p><pre>export class XYZService {</pre><pre>domain: string = this.app.env.baseUrl;</pre><pre>constructor(private _http: HttpClient, private app: AppInitService) {</pre><pre>}</pre><pre>getXYZInfoList(): Observable&lt;XYZInfo[]&gt; {</pre><pre>return this._http.get&lt;SwitchInfo[]&gt;(this.domain + &#39;api/list/xyzinfo&#39;).pipe(delay(1500));</pre><pre>}<br>...</pre><p>That’s all. You don’t need to compile your code for an environment change anymore. If you have multiple environments you can deploy once and just copy your delivery <strong>without overwriting assets/env.json </strong>unless it’s necessary to replace.</p><p>Starting right will make your life easier. Even though refactoring is an indispensable part of our routine.</p><p>\</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=810b89e6a501" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>