$settings['subman.settings']['service_url'] is confusing

Created on 23 November 2023, over 1 year ago
Updated 5 February 2024, about 1 year ago

Problem/Motivation

The variable name
$settings['subman.settings']['service_url'] is confusing. From the name "service_url" you'd expect it has to be a URL

The example in the README.md uses the string "production" or "sandbox", but I thought that was just a placeholder for the URL like https://sandbox.billwerk.com/

but it's expected to be one of the mentioned strings and then converted in the module:

  /**
   * Returns the remote service URL of the SaaS with an optional specific
   * service stub.
   *
   * @param string $service
   *   The additional uri part of the specific service endpoint stub.
   * @param string $system
   *   The additional uri part of the specific service endpoint stub.
   *
   * @return string
   *   The generated remote service url.
   */
  public function serviceUrl($service = '', $system = 'main') {
    $url = $this->utils->config('service_url', 'sandbox');
    switch ($url) {
      case 'production':
        $url = [
          'main' => 'https://app.billwerk.com/',
          'selfservice' => 'https://selfservice.billwerk.com/',
        ];
        break;

      case 'sandbox':
        $url = [
          'main' => 'https://sandbox.billwerk.com/',
          'selfservice' => 'https://selfservice.sandbox.billwerk.com/',
        ];
        break;
    }

    return $url[$system] . $service;
  }

Steps to reproduce

Proposed resolution

Typically, you would call this parameter "environment", not "service_url". This should be renamed on all levels and the old variable should be deprecated.

Of course it still has to work as fallback for existing installations!

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024