Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,18 @@ build-tools:
url: hostname
```

#### Self-Hosted GitHub

The GitHub URL used by Build Tools can be defined by updating the `build-tools:provider:git:github:url` configuration value, as demonstrated by the example below. Note that you will need to replace `hostname` with the actual GitHub instance hostname.

```
build-tools:
provider:
git:
github:
url: hostname
```

#### Starter Site Shortcuts

If you often create sites based on certain common starter sites, you may also use your Terminus configuration file to define custom starter site shortcuts. The example below defines shortcuts for the Lightning and Contenta distributions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Pantheon\TerminusBuildTools\ServiceProviders\RepositoryProviders\BaseGitProvider;
use Psr\Log\LoggerAwareInterface;
use Robo\Config\Config;
use Pantheon\Terminus\Exceptions\TerminusException;
use Pantheon\TerminusBuildTools\Credentials\CredentialClientInterface;
use Pantheon\TerminusBuildTools\ServiceProviders\RepositoryProviders\GitProvider;
Expand All @@ -25,9 +26,19 @@ class GitHubProvider extends BaseGitProvider implements GitProvider, LoggerAware
protected $api;


public function __construct(Config $config)
{
parent::__construct($config);
$privateGithub = $this->config->get('build-tools.provider.git.github.url');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @benjaminbradley

This looks great, but there's an underlying issue that makes this not work with env vars as described in this PR: #187

Could you please update this line to be:

        $privateGithub = $this->config->get('build-tools.provider.git.github.url') ?? getenv('TERMINUS_BUILD_TOOLS_PROVIDER_GIT_GITHUB_URL') ?? null;

so that this env var (TERMINUS_BUILD_TOOLS_PROVIDER_GIT_GITHUB_URL) can be used to override this behavior easily in CI?

Thanks!

Once merged, I'll create a follow-up PR to set that var when creating a project from scratch and I will probably request help to test it, it would be great if you can help with that at that time :)

if (!empty($privateGithub)) {
$this->baseGitUrl = 'git@' . $privateGithub;
}
}

public function infer($url)
{
return strpos($url, 'github.com') !== false;
$githubDomain = explode('@', $this->baseGitUrl)[1];
return strpos($url, $githubDomain) !== false;
}

/**
Expand Down