Skip to content

Commit

Permalink
Merge pull request #1 from codenamephp/initialImplementation
Browse files Browse the repository at this point in the history
Initial release
  • Loading branch information
bastianschwarz committed Mar 13, 2023
2 parents eae2d1c + 16b6d17 commit 006d01a
Show file tree
Hide file tree
Showing 18 changed files with 541 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/.gitignore export-ignore
/.gitattributes export-ignore
/.env.dist
/deployer.phar export-ignore
/docker-compose.yml export-ignore
/infection.json.dist export-ignore
/phive.xml export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
ci:
uses: codenamephp/workflows.php/.github/workflows/ci.yml@1
with:
php-versions: '["8.1","8.2]'
php-versions: '["8.1","8.2"]'
6 changes: 6 additions & 0 deletions .idea/copyright/Apache2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/deployer.secrets.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

130 changes: 130 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/php-test-framework.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/runConfigurations/All.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
}
],
"require": {
"php": "^8.1"
"php": "^8.1",
"codenamephp/deployer.base": "^3.0",
"codenamephp/platform.secretsmanager.base": "^1.0.1",
"deployer/deployer": "^7.2"
},
"autoload": {
"psr-4": {
Expand All @@ -34,12 +37,11 @@
"psalm": "tools/psalm --threads=10 --long-progress",
"composer-unused": "tools/composer-unused --no-progress --no-interaction",
"composer-require-checker": "tools/composer-require-checker --no-interaction",
"infection": "XDEBUG_MODE=coverage tools/infection --min-msi=95 --min-covered-msi=95 --threads=4 --no-progress --show-mutations",
"infection": "XDEBUG_MODE=coverage tools/infection --min-msi=100 --min-covered-msi=100 --threads=4 --no-progress --show-mutations",
"ci-all": [
"@phpunit",
"@psalm",
"@composer-unused",
"@composer-require-checker",
"@infection"
]
},
Expand All @@ -50,5 +52,8 @@
"composer-require-checker": "Checks for missing required composer packages",
"infection": "Creates mutation tests to discover missing test coverage",
"ci-all": "Runs all ci tools in sequence"
},
"require-dev": {
"mockery/mockery": "^1.5"
}
}
1 change: 1 addition & 0 deletions deployer.phar
3 changes: 2 additions & 1 deletion infection.json5.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
},
"mutators": {
"@default": true
}
},
"bootstrap":"./test/bootstrap.php"
}
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
cacheDirectory=".cache/psalm"
findUnusedBaselineEntry="true"
findUnusedCode="true"
autoloader="./test/bootstrap.php"
>
<projectFiles>
<directory name="src"/>
Expand Down
72 changes: 72 additions & 0 deletions src/Settings/SettingsInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php declare(strict_types=1);
/*
* Copyright 2023 Bastian Schwarz <[email protected]>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace de\codenamephp\deployer\secrets\Settings;

use de\codenamephp\platform\secretsManager\base\Secret\SecretInterface;
use Deployer\Host\Host;

/**
* Interface to set settings either globally or on hosts
*
* @psalm-api
*/
interface SettingsInterface {

/**
* Resolves the given secret and sets it either on all hosts or if no hosts are given as a global setting
*
* Implementations should make use of the \de\codenamephp\platform\secretsManager\base\Client\ClientInterface to resolve the secret
*
* @param string $settingsKey The key to set the payload of the secret to
* @param SecretInterface $secret The secret to get the payload for
* @param Host ...$hosts Hosts to set the secret on. If no hosts are given the secret will be set globally
* @return void
*/
public function set(string $settingsKey, SecretInterface $secret, Host ...$hosts) : void;

/**
* An array of settings keys and secrets to set. The array key is used as settings key.
*
* Resolves the given secrets and sets them either on all hosts or if no hosts are given as global settings
*
* Implementations should make use of the \de\codenamephp\platform\secretsManager\base\Client\ClientInterface to resolve the secrets
*
* @param array<string, SecretInterface> $secretsToSet The key/secrets mapping
* @param Host ...$hosts Hosts to set the secrets on. If no hosts are given the secrets will be set globally
* @return void
*/
public function setMultiple(array $secretsToSet, Host ...$hosts) : void;

/**
* Fetches the payload content of the given secret. Implementations should use the \de\codenamephp\platform\secretsManager\base\Client\ClientInterface to
* resolve the secret
*
* @param SecretInterface $secret The secret to fetch the payload for
* @return string The payload content
*/
public function fetch(SecretInterface $secret) : string;

/**
* Fetches the payload content of the given secrets. Implementations should use the \de\codenamephp\platform\secretsManager\base\Client\ClientInterface to
* resolve the secrets. Implementations MUST preserve the order and array keys of the given array as they may be used to identify the secrets
*
* @param array<SecretInterface> $secretsToResolve The secrets to fetch the payload for
* @return array<string> The payload content of the secrets with the keys preserved
*/
public function fetchMultiple(array $secretsToResolve) : array;
}
Loading

0 comments on commit 006d01a

Please sign in to comment.