This repository has been archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrations config and hooks refactoring #4
- Loading branch information
Showing
17 changed files
with
319 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Integrations/Warden.Spawn.Integrations.Console/ConsoleService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Warden.Spawn.Integrations.Console | ||
{ | ||
public class ConsoleService : IConsoleService | ||
{ | ||
private readonly ConsoleSpawnIntegrationConfiguration _integrationConfiguration; | ||
|
||
public ConsoleService(ConsoleSpawnIntegrationConfiguration integrationConfiguration) | ||
{ | ||
_integrationConfiguration = integrationConfiguration; | ||
} | ||
|
||
public async Task PrintAsync(object configuration) | ||
{ | ||
var config = configuration as ConsoleSpawnIntegrationHooksConfiguration; | ||
if (config == null) | ||
throw new InvalidOperationException(); | ||
|
||
var text = string.IsNullOrWhiteSpace(config.Text) ? _integrationConfiguration.DefaultText : config.Text; | ||
|
||
await Task.Factory.StartNew(() => System.Console.WriteLine(text)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.