Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 2911db4

Browse files
committed
Merge pull request #112 from danepowell/feature/acsf-aliases
Support ACSF vanity domains.
2 parents b9524f2 + b23a46b commit 2911db4

File tree

1 file changed

+50
-45
lines changed

1 file changed

+50
-45
lines changed

template/drush/site-aliases/example.acsf.aliases.drushrc.php

+50-45
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@
66
// Acquia Cloud Site Factory id.
77
$site_id = '[PROJECT-NAME]';
88

9-
// List of sites. For each site, one record should be added.
9+
/**
10+
* List of sites. For each site, one record should be added.
11+
* Optionally, you can also list vanity domains for each site.
12+
*
13+
* @code
14+
* $sites = array(
15+
* 'demo' => array(
16+
* 'dev' => 'dev.demo.example.com',
17+
* 'test' => 'test.demo.example.com',
18+
* 'prod' => 'demo.example.com',
19+
* ),
20+
* );
21+
* @endcode
22+
*/
1023
$sites = array(
1124
'demo',
1225
);
@@ -18,60 +31,52 @@
1831
$dev_web = 'staging-###';
1932

2033
// =======================END OF CONFIGURATION==============================.
21-
2234
if ($site_id !== '[PROJECT-NAME]') {
23-
2435
// Acquia Cloud Site Factory environment settings.
25-
$acsf_prod = array(
26-
'remote-user' => $site_id . '.01live',
27-
'root' => '/var/www/html/' . $site_id . '.01live/docroot',
28-
'remote-host' => $prod_web . '.enterprise-g1.hosting.acquia.com',
29-
);
30-
31-
$acsf_stage = array(
32-
'remote-user' => $site_id . '.01test',
33-
'root' => '/var/www/html/' . $site_id . '.01test/docroot',
34-
'remote-host' => $dev_web . '.enterprise-g1.hosting.acquia.com',
35-
);
36-
37-
$acsf_dev = array(
38-
'remote-user' => $site_id . '.01dev',
39-
'root' => '/var/www/html/' . $site_id . '.01dev/docroot',
40-
'remote-host' => $dev_web . '.enterprise-g1.hosting.acquia.com',
36+
$envs = array(
37+
'prod' => array(
38+
'remote-user' => $site_id . '.01live',
39+
'root' => '/var/www/html/' . $site_id . '.01live/docroot',
40+
'remote-host' => $prod_web . '.enterprise-g1.hosting.acquia.com',
41+
),
42+
'test' => array(
43+
'remote-user' => $site_id . '.01test',
44+
'root' => '/var/www/html/' . $site_id . '.01test/docroot',
45+
'remote-host' => $dev_web . '.enterprise-g1.hosting.acquia.com',
46+
),
47+
'dev' => array(
48+
'remote-user' => $site_id . '.01dev',
49+
'root' => '/var/www/html/' . $site_id . '.01dev/docroot',
50+
'remote-host' => $dev_web . '.enterprise-g1.hosting.acquia.com',
51+
),
4152
);
42-
4353
// These defaults connect to the Acquia Cloud Site Factory.
4454
$acsf_defaults = array(
4555
'ssh-options' => '-p 22',
4656
'path-aliases' => array(
4757
'%dump-dir' => '/mnt/tmp/'
4858
)
4959
);
50-
5160
// Create the aliases using the defaults and the list of sites.
52-
foreach ($sites as $site) {
53-
$aliases[$site . '.dev'] = array_merge(
54-
$acsf_defaults,
55-
$acsf_dev,
56-
array(
57-
'uri' => $site . '.dev-' . $site_id . '.acsitefactory.com',
58-
)
59-
);
60-
61-
$aliases[$site . '.stage'] = array_merge(
62-
$acsf_defaults,
63-
$acsf_dev,
64-
array(
65-
'uri' => $site . '.test-' . $site_id . '.acsitefactory.com',
66-
)
67-
);
68-
69-
$aliases[$site . '.prod'] = array_merge(
70-
$acsf_defaults,
71-
$acsf_prod,
72-
array(
73-
'uri' => $site . '.' . $site_id . '.acsitefactory.com',
74-
)
75-
);
61+
foreach ($sites as $site_name => $site_domains) {
62+
if (!is_array($site_domains)) {
63+
$site_name = $site_domains;
64+
}
65+
foreach ($envs as $env_name => $env_info) {
66+
$uri = $site_name . '.' . $env_name . '-' . $site_id . '.acsitefactory.com';
67+
if ($env_name == 'prod') {
68+
$uri = $site_name . '.' . $site_id . '.acsitefactory.com';
69+
}
70+
if (is_array($site_domains) && isset($site_domains[$env_name])) {
71+
$uri = $site_domains[$env_name];
72+
}
73+
$aliases[$site_name . '.' . $env_name] = array_merge(
74+
$acsf_defaults,
75+
$env_info,
76+
array(
77+
'uri' => $uri,
78+
)
79+
);
80+
}
7681
}
7782
}

0 commit comments

Comments
 (0)