title: How to define baseURL based on ENVIRONMENT in CodeIgniter 4
body: <p>Upgraded from CodeIgniter 3 to CodeIgniter 4 and at the begining I found a problem I cannot resolve.
  In CI3 I had a switch statement in <code>application/config/config.php</code> to set the <code>$config['base_url']</code>.
  It's like</p>
  
  <pre><code>$localFolder = "localfolder";
  
  switch (ENVIRONMENT) {
      case 'development':
          $config['base_url'] = "http://$localFolder.loc";
          break;
  
      default:
          $config['base_url'] = "http://testserver.com/$localFolder";
          break;
  }
  </code></pre>
  
  <p>But in CI4 the <code>app/Config/App.php</code> is now a class and I haven't figured out how could I define the <code>public $baseURL = "samplefolder";</code> based on the <code>ENVIRONMENT</code> variable.</p>
  
  <p>Calling a function immediately not working:</p>
  
  <pre><code>public $baseURL = (function(){
          switch (ENVIRONMENT) {
              case 'development':
                  $this-&gt;baseURL = "http://$localFolder.loc";
                  break;
  
              default:
                  $this-&gt;baseURL = "http://testserver.com/$localFolder";
                  break;
          }
      })();
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Fatal error: Constant expression contains invalid operations
  </code></pre>
  
  <p>Also, calling the function after declaring with <code>$this-&gt;</code> produces error:</p>
  
  <pre><code>public $baseURL = "";
  
  public function baseURL($localFolder)
      {
          switch (ENVIRONMENT) {
              case 'development':
                  $this-&gt;baseURL = "http://$localFolder.loc";
                  break;
  
              default:
                  $this-&gt;baseURL = "http://testserver.com/$localFolder";
                  break;
          }
      }
  
  $this-&gt;baseURL("localfolder");
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Parse error: syntax error, unexpected '$this' (T_VARIABLE), expecting function (T_FUNCTION) or const (T_CONST)
  </code></pre>
  
  <p>I would appreciate any help!</p>