Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Different hooks for connections #767

Open
iantearle opened this issue May 4, 2018 · 1 comment
Open

Different hooks for connections #767

iantearle opened this issue May 4, 2018 · 1 comment

Comments

@iantearle
Copy link

Is it possible to define different hooks for each connection?

@ishegg
Copy link

ishegg commented May 15, 2018

I'm not sure if there's an official way, but I can think of two:

  • Create a connections folder inside .rocketeer and a new folder for each connection, then place a hooks.php inside each with the specific rules (example: .rocketeer/connections/staging/hooks.php). I haven't tried it for hooks but I do it for SCM with all my projects and it works perfectly.
  • The second way is using getConnection() inside a Task. So for instance, in anafter-deploy hook you can do this:
'after'  => [
	'deploy'  => [
		function ($task) {
			$env = $task->connections->getConnection();
			if ($env === "staging") {
				// do staging-specific stuff
			}
		}
	],
],```

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants