<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[None In Site]]></title><description><![CDATA[None particularly sighted]]></description><link>https://blog.nonein.site/</link><image><url>https://blog.nonein.site/favicon.png</url><title>None In Site</title><link>https://blog.nonein.site/</link></image><generator>Ghost 3.14</generator><lastBuildDate>Thu, 26 Mar 2026 04:19:02 GMT</lastBuildDate><atom:link href="https://blog.nonein.site/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[4 years?]]></title><description><![CDATA[<p>It's good to be back posting! A lot has changed over the years and I'm excited to see what I can write for this blog with my involvement with cloud infrastructure. That gave me an idea. Why not start here?</p><p>Don't get mad at me when I'm announcing that the</p>]]></description><link>https://blog.nonein.site/all/20240220/4-years/</link><guid isPermaLink="false">65d48b4005214c317c8c7d3c</guid><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Tue, 20 Feb 2024 11:31:16 GMT</pubDate><content:encoded><![CDATA[<p>It's good to be back posting! A lot has changed over the years and I'm excited to see what I can write for this blog with my involvement with cloud infrastructure. That gave me an idea. Why not start here?</p><p>Don't get mad at me when I'm announcing that the server this blog is on hasn't been updated for the same amount of time the last time I posted. It's reality. We move on to other things in life, that explains the abscence even though this blog is still existing. With that out of the way, I'll start squeezing updates for the server the blog is on and see anything else I can do from there.</p><p>Until then,</p><p>~rhz</p>]]></content:encoded></item><item><title><![CDATA[Settling with CORS]]></title><description><![CDATA[<blockquote>Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. A web page may freely embed cross-origin images, stylesheets, scripts, iframes, and videos.[1]</blockquote><p>I usually encounter this issue</p>]]></description><link>https://blog.nonein.site/sysops/20200720/settling-with-cors/</link><guid isPermaLink="false">5f102be64b49da07efdc51a8</guid><category><![CDATA[sysops]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Mon, 20 Jul 2020 14:25:20 GMT</pubDate><content:encoded><![CDATA[<blockquote>Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. A web page may freely embed cross-origin images, stylesheets, scripts, iframes, and videos.[1]</blockquote><p>I usually encounter this issue every now and then. Sometimes it can be fixed on my end while other times it's fixed on the developer's end. It could get problematic if future maintainers do not know where it is configured. There are three possible ways where CORS can be configuered, namely through</p><ul><li>Service Provider</li><li>HTTP Server</li><li>Application</li></ul><p>Service Provider could mean it can be configured over the management consoles of, i.e. AWS, Azure, GCP, and among others. HTTP Servers such as Nginx and Apache. And lastly through the application. How it implemented will depend on how the infrastructure is architected.</p><p>Whenever possible I would recommend in configuring it through the service provider. This would leave out the burden for system administrators or developers in having to do it on their end. If that's not possible, the HTTP server will then suffice. Only do it inthe application as a last resort or by the limitation of not doing it through the other two.</p><h3 id="service-provider">Service Provider</h3><p>Documentation for configuring CORS in AWS's console can be found <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html">here</a>. It comes with two options, enabling it over GUI in the console or enabling it with OpenAPI definition.</p><h3 id="http-server">HTTP Server</h3><p>Configuring it in Nginx will fall into the <code>location</code> block.</p><pre><code class="language-Nginx Conf">location / {
  add_header "Access-Control-Allow-Origin" * always;
  add_header "Access-Control-Allow-Credentials" *;
  add_header "Access-Control-Allow-Methods" *;
  add_header "Access-Control-Allow-Headers" *;
  proxy_set_header HOST $host;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

  proxy_pass http://upstream;
}</code></pre><h3 id="application">Application</h3><p>Probably the easiest to integrate it is through the application itself. I'll be using <code>flask</code> in this article.</p><p>Install <a href="https://flask-cors.corydolphin.com/">Flask-CORS</a> with <code>pip install flask-cors</code></p><pre><code class="language-Python">app = Flask(__name__)
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})</code></pre><h3 id="final-thoughts">Final Thoughts</h3><p>From the examples above, it is recommended to limit the origin only through the domain in which it is needed. And I hope that you dear reader may have an idea on how to properly architect your APIs with this read.</p><p></p><h5 id="resources">Resources</h5><p>1: <a href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing">https://en.wikipedia.org/wiki/Cross-origin_resource_sharing</a></p>]]></content:encoded></item><item><title><![CDATA[Standalone WEMP]]></title><description><![CDATA[<p>Yet another one of those "How to Setup a WEMP Stack" how-to. While other users prefer to get it done simply; I want to get down and dirty to keep things organized in my own liking.</p><!--kg-card-begin: markdown--><h2 id="packages">Packages</h2>
<ul>
<li><a href="https://nginx.org/en/download.html">Nginx</a></li>
<li><a href="https://windows.php.net/download">PHP</a>*</li>
<li><a href="https://downloads.mariadb.org/">MariaDB</a></li>
</ul>
<blockquote>
<p>There is an alternative way in installing the packages by</p></blockquote>]]></description><link>https://blog.nonein.site/sysops/20200508/standalone-wemp/</link><guid isPermaLink="false">5eaa6418c1947f144273b38c</guid><category><![CDATA[sysops]]></category><category><![CDATA[windows]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Fri, 08 May 2020 06:53:59 GMT</pubDate><content:encoded><![CDATA[<p>Yet another one of those "How to Setup a WEMP Stack" how-to. While other users prefer to get it done simply; I want to get down and dirty to keep things organized in my own liking.</p><!--kg-card-begin: markdown--><h2 id="packages">Packages</h2>
<ul>
<li><a href="https://nginx.org/en/download.html">Nginx</a></li>
<li><a href="https://windows.php.net/download">PHP</a>*</li>
<li><a href="https://downloads.mariadb.org/">MariaDB</a></li>
</ul>
<blockquote>
<p>There is an alternative way in installing the packages by using the Chocolatey package manager. The only caveat is you can't customize the installation directory in the free version. If you're willing to shell out $96/yr to free you of worry. Then why not?</p>
</blockquote>
<blockquote>
<p><em>* Download the Non Thread Safe as it fits with Nginx</em></p>
</blockquote>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><h2 id="settingup">Setting Up</h2>
<p>You could create a directory under any drive of your choice with my existing structure as reference.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: html--><pre>
/c/Dev/Bin
/c/Dev/Programs
    : /nginx
    : /php
/c/Dev/Code
</pre><!--kg-card-end: html--><blockquote>There is a Bin folder included which we will use to add it in our system path and linking binaries using <strong>batch </strong>and <strong>bash</strong>.</blockquote><p>In the Bin folder we will have a batch script that acts a runner to boot up Nginx and PHP. It is a modified version of the original batch script I have been using over the years.</p><!--kg-card-begin: html--><pre>/c/Dev/Bin/servers.cmd</pre>
<script src="https://gist.github.com/rmrhz/0e008971f3fd3a64b0caf4544dca78e3.js"></script><!--kg-card-end: html--><p>Finally add "C:\Dev\Bin" to your path of your environment variables. Now you can now call "servers.cmd" in MINGW64 or "servers" in Command Prompt.</p>]]></content:encoded></item><item><title><![CDATA[Philosophy Of Clean Coding]]></title><description><![CDATA["Programming was always a messy job, and neither it is pretty."]]></description><link>https://blog.nonein.site/programming/20180924/philosophy-of-clean-coding/</link><guid isPermaLink="false">5bda427f8d1b455c59ee870f</guid><category><![CDATA[programming]]></category><category><![CDATA[tidbits]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Mon, 24 Sep 2018 19:48:48 GMT</pubDate><content:encoded><![CDATA[<p>Explaining everything in code will not entice you, the reader, in writing clean code. As far as I can tell you, my principle of writing code is for other people who may end up reading it. will understand it at sightread. Quite in fact this could be summed up with only a few words.</p><p><em>"Write code as if monkeys would be able to read it"</em>.</p><p>Easy said than done. Think about it, if people treat programming as poetry. Then even a beginner would be able to understand what you wrote on sightread.</p>]]></content:encoded></item><item><title><![CDATA[Everyone Needs to Inform Themselves]]></title><description><![CDATA[Traveling is not always what you imagined and you should know what you're getting yourself into.]]></description><link>https://blog.nonein.site/travel/20180819/everyone-needs-to-inform-themselves/</link><guid isPermaLink="false">5bda427f8d1b455c59ee870d</guid><category><![CDATA[travel]]></category><category><![CDATA[personal]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Sun, 19 Aug 2018 23:35:38 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>There was a recent airline <a href="https://www.straitstimes.com/asia/se-asia/a-plane-belonging-to-chinas-xiamen-airlines-crash-lands-in-manila">accident</a>, which led to numerous delays and eventually become cancellations in the most busiest airports in the country. It happened just when passengers are flocking in to spend their vacation due to holidays in the upcoming week. Though what comes after the accident infuriates me the most.</p>
<p>Being a traveler myself, I have my fair share of delays on different circumstances. I can recall at least three.</p>
<ul>
<li>
<p>The airline crew manning the gate never had a single clue what happened to our aircraft which delayed the flight for at least three hours. The PA system also informed us that the plane didn't arrive yet. When actually the plane (Airbus A330) was just in front of us all along! Apparently the maintenance crew have to replace one of its wheels for safety reasons if I would assume so. What ticked me off is when they never used any kind of power tools for it!</p>
</li>
<li>
<p>Same airline as above but a different case. Boarding was delayed for an hour and another hour by the time we got on. There was a medical emergency that happened the flight before and we were not cleared for taxi unless the required medical equipment was replenished. The airline crew still never had a single clue of what happened.</p>
</li>
<li>
<p>Flight was delayed for six hours after assumingly the pilots declared the aircraft we're about to fly into is not fit for flying. Imagine your flight is delayed for six long hours, how would you feel? I for one, just want to be at my destination and go to bed right way. Unfortunately the case for my fellow passengers were far more worse. I can assume most of them are on the last leg of their trip from an international flight. I can also assume that they haven't got enough sleep and now are getting agitated and/or irritated on what the hell is going on with their flight. As I mentioned in the two examples above, the airline crew never had a single clue.</p>
</li>
</ul>
<p>What infuriates me the most is not with any kind of incident but with the passengers themselves. Traveling is not supposed to be a one way ticket for whatever reason your trip is. There will always be unforseen circumstances that sidelines us from the original plan. People will talk about contingency plans after and not before it happens.</p>
<p>It all starts by the time you book your ticket. It's common knowledge that you should be getting travel insurance every single time. Good if you're booking it yourself but not for the rest who book their tickets in travel agencies and in ticketing booths. Not buying insurance just to cut down your expenses will be the single biggest mistake you'll be making when you're traveling. You'll be in a different world of hurt and nothing can save you other than the huge fees you'll be paying, if you're willing to.</p>
<p>Apart from that, another thing that infuriates me is when passengers are getting ahead of themselves in the check-in counter. This happens a lot of times when I'm on budget airlines. They start complaining when their baggage are either oversized or overweight then will pick up a fight since they don't like to pay additional fees. If I can recall your baggage allowance is stated over your itinerary document. Isn't it hard for everyone to read it?</p>
<p>Going back, what happened last Friday was tragic but I can't help myself getting mad with people who know nothing of the basics of air travel. Accidents happen but it isn't the airport's responsbility to take care of stranded passengers. That's the job of the airline. If the airline doesn't cooperate with their grievances, then they have the opportunity to escalate it to the Civil Aeronautics Board. We also do not need another <a href="https://www.philstar.com/headlines/2018/08/20/1844172/naia-fiasco-senate-summon-officials">senate inquiry</a>. The gesture is noble but it always end up being unproductive and wasting everyone's time.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Learning More of Javascript Behavior]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>I've written an <a href="https://blog.nonein.site/2018/04/25/working-with-authentication-storage-in-ionic/">article</a> before that describes my first experience with the asynchronous nature of Javascript. In this article I'm going to expand further on what I've learned</p>
<h5 id="makingtheasynchronoussynchronous">Making The Asynchronous, Synchronous</h5>
<p>While going further with the project later did I realize on how to use the sorcery of <em>async</em></p>]]></description><link>https://blog.nonein.site/programming/20180811/learning-more-of-javascript-behavior/</link><guid isPermaLink="false">5bda427f8d1b455c59ee870c</guid><category><![CDATA[programming]]></category><category><![CDATA[javascript]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Sat, 11 Aug 2018 21:35:07 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>I've written an <a href="https://blog.nonein.site/2018/04/25/working-with-authentication-storage-in-ionic/">article</a> before that describes my first experience with the asynchronous nature of Javascript. In this article I'm going to expand further on what I've learned</p>
<h5 id="makingtheasynchronoussynchronous">Making The Asynchronous, Synchronous</h5>
<p>While going further with the project later did I realize on how to use the sorcery of <em>async</em> and <em>await</em>. Being a lazy uneducated programmer I am. I usually skip explanations in favor the result of the source code or the snippet may bring.</p>
<p>The way I see it, I usually encounter certain types of tutorials or guides; In which I have to watch a whole video, or skim through the whole article just to get an idea on its behavior. This doesn't sit well with me as I'm impatient and lazy. I skip to the part seeing how it works <em>or copy and pasting the code to see if it works</em> then torturing myself on the explanation. Only then ironically, I'll have an interest on almost anything technical.</p>
<p>The simplest and dumbed down explanation on the usage of async / await is to make the process syncrhonous or blocking. As what I've stated in the previous article. I'm used to blocking behavior so I'll assume that the process is synchronous as long as I use the two keywords. And that didn't go well for me at first.</p>
<pre><code>async foo() : Promise {
  // process here
  return Promise.resolve(true);
}

var bar = await foo();
</code></pre>
<p>Yes, I know. It is dumb. I should've been more diligent enough to read first, but in the spirit of programming. Understanding things based on trial and error is where I grew from.</p>
<pre><code>async foo() : Promise {
  return new Promise((resolve, reject) =&gt; {
    // process here
    resolve(true);
  });
}

var bar = await bar();
</code></pre>
<p>It took a good night worth of sleep just to realize that what I've been doing is all wrong. The right way of doing it is to do the process within the <code>Promise</code> and only then it behaved from what I originally expected.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Working With Authentication & Storage in Ionic]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h5 id="divein">Dive In!</h5>
<p>Two months ago I was given a project to work in a mobile app that I decided to be written in the Ionic Framework. Working with the framework was a fun experience which I found a new love and hate relationship with the Javascript ecosystem. Though I haven't</p>]]></description><link>https://blog.nonein.site/programming/20180425/working-with-authentication-storage-in-ionic/</link><guid isPermaLink="false">5bda427f8d1b455c59ee870b</guid><category><![CDATA[programming]]></category><category><![CDATA[ionic]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Wed, 25 Apr 2018 11:52:56 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h5 id="divein">Dive In!</h5>
<p>Two months ago I was given a project to work in a mobile app that I decided to be written in the Ionic Framework. Working with the framework was a fun experience which I found a new love and hate relationship with the Javascript ecosystem. Though I haven't delved into the specifics, learning something new is definitely the most rewarding thing out of it.</p>
<p>Everything should be straightforward unless you're emulating over a browser. One of those is <em>every HTTP request is treated as a CORS request</em>. <em>This only applies for local development.</em></p>
<p>Take below as an example.</p>
<pre><code class="language-typescript">const headers = new HttpHeaders({'Content-Type': 'application/json'});

this.http.post(ENV.API_ENDPOINT + '/oauth/token'), {
      username: credentials.email,
      password: credentials.password,
      client_id: ENV.API_CLIENT,
      client_secret: ENV.API_SECRET,
      grant_type: 'password'
    }, {headers: headers})
    .toPromise();
</code></pre>
<p>Normally you would expect the request would translate as <code>200 POST https://domain.tld/oauth/token</code> but instead it would request <code>200 OPTIONS https://domain.tld/oauth/token</code> before doing a POST request. The solution was straightforward, setup a proxy url.</p>
<pre><code>// ionic.config.json
&quot;proxies&quot;: [
    {
      &quot;path&quot;: &quot;/oauth/token&quot;,
      &quot;proxyUrl&quot;: &quot;http://domain.local/api/oauth/token&quot;
    }
]
</code></pre>
<p>Now we just need to replace URL parameter for <code>http.post</code>.</p>
<pre><code>const uri = '/oauth/token';

this.http.post((ENV.ENVIRONMENT === 'production' ? ENV.API_ENDPOINT + uri : uri), {
</code></pre>
<p>After running <code>ionic serve</code> again everything is now running smoothly.</p>
<h5 id="asyncstorage">Async Storage?</h5>
<p>The most frustrating part was working with the storage component. Looking through the documentation it's very straightforward enough. You only need to speciy <code>key</code> and <code>value</code> parameters to save the data. The symptom started showing when I was going to redirect the user to the <code>HomePage</code>.</p>
<p>Below is an excerpt from <code>home.ts</code></p>
<pre><code class="language-typescript">this.storage.get('user').then((data) =&gt; {
  this.name = data.name;
  this.email = data.email;
}).catch(err =&gt; {
  console.log(err);
});
</code></pre>
<p>It took at least two pages before I <code>data</code> is populated. What was happening behind was interesting. Lets just assume that we're still about to authorize into the system. This makes the value of <code>user</code> is <code>undefined</code>. Now when you're successfully authorized the value of <code>user</code> turns <code>null</code>. What I expected from the start that it should contain the <code>User</code> object. It only returns the correct object after getting redirected over and over for at least two to three times.</p>
<p>The solution was to wait it out. I made a placeholder page which turned into a processing page for data syncing tasks. Then set a sleep timer for at least 3 to 5 seconds or if there are successful promises returned.</p>
<h5 id="conclusion">Conclusion</h5>
<p>Coming from languages with blocking background this was my first taste in experience how asynchronous processes work. A good lesson learned while getting through a hellish language.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Account Retrieval : Uber vs Grab]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>This post is long due after I posted my blog <a href="https://blog.nonein.site/2018/02/27/losing-a-phone/">post</a> of losing a phone. After getting a new phone I then downloaded Uber &amp; Grab. When trying to login with my usual credentials. I quickly hit the wall as a security measure, an SMS code should be inputted. Being</p>]]></description><link>https://blog.nonein.site/personal/20180318/account-retrieval-uber-vs-grab/</link><guid isPermaLink="false">5bda427f8d1b455c59ee870a</guid><category><![CDATA[personal]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Sun, 18 Mar 2018 20:42:26 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>This post is long due after I posted my blog <a href="https://blog.nonein.site/2018/02/27/losing-a-phone/">post</a> of losing a phone. After getting a new phone I then downloaded Uber &amp; Grab. When trying to login with my usual credentials. I quickly hit the wall as a security measure, an SMS code should be inputted. Being quite in a dilemma, the most sanest choice is to contact customer support of both companies.</p>
<p>Retrieving my Uber account was easy as they only need to change the phone number in the system. By the time Grab replied to my ticket, I'm about to hit another wall.</p>
<blockquote>Good day!
<p>Thank you for your email and we appreciate your time reaching us today! This is -redacted-, a member of Grab's Customer Experience team.</p>
<p>I want to apologize for the inconvenience this has caused you. We do not suggest our passengers to change the phone number you already registered in your account as per Technical Team confirmed that the passenger might encounter problems if they choose to change there phone number.</p>
<p>Every phone number this is already tied up with the account they initially created as per advise as well by our Technical Team to prevent fraudulent activities.</p>
<p>If passenger choose to change the phone number they need to create another account and deactivate the previous account they have but then the points and tier they gained will be automatically lost. What we can also suggest is to put the number to the driver's note in the booking passengers made to informed drivers.</p>
<p>We hope this information was of helps!</p></blockquote><p></p>
<p>Reading it again I don't know if I should cry or throw a huge tantrum as my bullshit meter is about to go full. I want to ask a few questions for myself.</p>
<blockquote>
<p>Technical Team confirmed that the passenger might encounter problems if they choose to change there phone number.</p>
</blockquote>
<p>Is this serious?</p>
<blockquote>
<p>Every phone number this is already tied up with the account they initially created as per advise as well by our Technical Team to prevent fraudulent activities.</p>
</blockquote>
<p>Are you fucking serious?</p>
<p>And lastly.</p>
<blockquote>
<p>If passenger choose to change the phone number they need to create another account and deactivate the previous account they have but then the points and tier they gained will be automatically lost.</p>
</blockquote>
<p>This is absolute bullshit.</p>
<p>Going over it and I'm sorry if I have to throw accusations but if that's the logic of the technical team on implementing such security measure. 1) That's not they're department to do so &amp; 2) They're totally inept security practices at all. Let alone if the point of customer service is to relieve the inconvenience of your customer, you're intentionally giving more inconvenience to them.</p>
<p>What could have caused this problem?</p>
<p>The only reason to believe that this problem exist is when the technical team made the phone number, the primary key in the database. If they're using relational databases that's adding insult to injury. If they're using NoSQL then it <em>arbitrarily</em> explains the nonsensical reason they gave me.</p>
<p>I still don't get it why they have to deactivate or <em>delete</em> the account just to have a new number associated with it.</p>
<p>That's not the end of it.</p>
<p>At first when I tried logging in with a social button. I.e. Google Login; It either do the following 1) if the email is associated with a registered user, ask the user to login 2) if the email is not associated, do the usual register flow. When I tried it on Grab, it immediately gave an error <em>&quot;email already exists&quot;</em>. I was completely dumbfounded by this. How come this very simple flow was never implemented in the first place? And how come this is overlooked?</p>
<p>Being a programmer myself, it stressed me out very much.</p>
<p>Going over with Uber's support was very smooth I only need to fill up my name, phone number on file, two recent uber trips made, email on file, and other details regarding about the concern. Support replied and asked me for confirmation to change the phone number, I replied the affirmative, <em>poof</em> number changed! That simple! Not only that, when I tried logging via social button, it asked me to input user credentials. That's a major difference right for user experience.</p>
<p>The lessons to be learned from this are,</p>
<ol>
<li>Never let the technical team do security implementations that will cause a user inconvenience</li>
<li>Catch the earliest signs of user experience design flaws before you're causing more inconvenience to the user</li>
</ol>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Consolidating Configuration Over Yii2]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>A little while back I was engaged into a project that centers around Yii2. Though it has one problem. Configuration. Yep. The configuration for Yii2 is a total mess.</p>
<p>To give you a better perspective on how it works, each <em>module</em> has its own configuration folder and a common configuration</p>]]></description><link>https://blog.nonein.site/programming/20171228/consolidating-configuration-over-yii2/</link><guid isPermaLink="false">5bda427f8d1b455c59ee8704</guid><category><![CDATA[programming]]></category><category><![CDATA[php]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Thu, 28 Dec 2017 15:23:38 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>A little while back I was engaged into a project that centers around Yii2. Though it has one problem. Configuration. Yep. The configuration for Yii2 is a total mess.</p>
<p>To give you a better perspective on how it works, each <em>module</em> has its own configuration folder and a common configuration folder. Lastly each having their own <code>web</code> or <code>www/public</code> folder.</p>
<p>To wire all of them together it does <code>require_once</code> or <code>include</code> throughout the header of a config file. Adding to the mess is production config values are included in the SCM! To remedy this I have to do three things</p>
<ul>
<li>Centralize the configuration</li>
<li>Config values utilize environment variables from an <code>.env</code> file</li>
<li>Centralize the public folder</li>
</ul>
<h3 id="otherproblems">Other Problems</h3>
<p>Throughout the whole ordeal I encountered certain problems that gave me an initial perspective on how Yii2 works in the background. I have to do some quirks in order to go around these problems and make the site work.</p>
<ul>
<li><code>base_path</code> is based on the module base directory. It created a problem whereas aliases for assets, views, and config files will resolve to the module's base path instead of the newly altered structure.</li>
<li><code>request</code>, <code>errorHandler</code> components when included in the console config creates an error in the default <code>yii</code> console runner.</li>
</ul>
<h3 id="structure">Structure</h3>
<p>The two most significant changes on the Yii project is the addition of a <code>config/</code>, <code>public/</code> folders with their respective files and a console runner that can run the changes made throughout the structure.</p>
<p>One of the biggest advantages in the new structure is you don't have to worry about same values in your configs throughout in your project/module directories. Lastly it provides a reasonable improvement in leaving out sensitive values out from the SCM.</p>
<h3 id="sourcecode">Source Code</h3>
<p>The code speaks for itself. If you have questions please contact me over Twitter.</p>
<script src="https://gist.github.com/rmrhz/8eaf27e290a8b9f4241f66ddfea7cca6.js"></script><!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[The Long Overdue Blog]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>Here we go again and hopefully I wont neglect the responsibility to keep up a simple blog. Things recently are changing, fast. Really fast. To keep up with what's going on, I'll maintain <em>hopefully</em> this one.</p>
<p>I wont speculate what I'm going to write in the coming weeks but it's</p>]]></description><link>https://blog.nonein.site/personal/20171222/the-long-overdue-blog/</link><guid isPermaLink="false">5bda427f8d1b455c59ee8703</guid><category><![CDATA[personal]]></category><dc:creator><![CDATA[rhz]]></dc:creator><pubDate>Fri, 22 Dec 2017 13:31:31 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Here we go again and hopefully I wont neglect the responsibility to keep up a simple blog. Things recently are changing, fast. Really fast. To keep up with what's going on, I'll maintain <em>hopefully</em> this one.</p>
<p>I wont speculate what I'm going to write in the coming weeks but it's going to range from a variety of interests. If you personally know me you might be already familiar of what I'm going to post so I'll just leave it to that.</p>
<p>Cheers,<br>
rhz</p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>