-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
11,718 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,3 @@ | ||
/vendor/ | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# Laravel 4 specific | ||
bootstrap/compiled.php | ||
app/storage/ | ||
|
||
# Laravel 5 & Lumen specific | ||
public/storage | ||
public/hot | ||
|
||
# Laravel 5 & Lumen specific with changed public path | ||
public_html/storage | ||
public_html/hot | ||
|
||
storage/*.key | ||
.env | ||
Homestead.yaml | ||
Homestead.json | ||
/.vagrant | ||
.idea | ||
.phpunit.result.cache |
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,165 @@ | ||
<?php | ||
// https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200#gistcomment-3755709 | ||
|
||
// https://cs.symfony.com/doc/rules/index.html | ||
$rules = [ | ||
'array_syntax' => ['syntax' => 'short'], | ||
|
||
'blank_line_after_namespace' => true, | ||
'blank_line_after_opening_tag' => true, | ||
'braces' => true, | ||
'cast_spaces' => true, | ||
'concat_space' => [ | ||
'spacing' => 'one', | ||
], | ||
'declare_equal_normalize' => true, | ||
'elseif' => true, | ||
'encoding' => true, | ||
'full_opening_tag' => true, | ||
'fully_qualified_strict_types' => true, // added by Shift | ||
'function_declaration' => true, | ||
'function_typehint_space' => true, | ||
'heredoc_to_nowdoc' => true, | ||
'include' => true, | ||
'increment_style' => ['style' => 'post'], | ||
'indentation_type' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'line_ending' => true, | ||
'lowercase_cast' => true, | ||
'lowercase_keywords' => true, | ||
'lowercase_static_reference' => true, // added from Symfony | ||
'magic_method_casing' => true, // added from Symfony | ||
'magic_constant_casing' => true, | ||
'method_argument_space' => true, | ||
'native_function_casing' => true, | ||
'no_alias_functions' => true, | ||
'no_extra_blank_lines' => [ | ||
'tokens' => [ | ||
'extra', | ||
'throw', | ||
'use' | ||
], | ||
], | ||
'no_blank_lines_after_class_opening' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_closing_tag' => true, | ||
'no_empty_phpdoc' => true, | ||
'no_empty_statement' => true, | ||
'no_leading_import_slash' => true, | ||
'no_leading_namespace_whitespace' => true, | ||
'no_mixed_echo_print' => [ | ||
'use' => 'echo', | ||
], | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'multiline_whitespace_before_semicolons' => [ | ||
'strategy' => 'no_multi_line', | ||
], | ||
'no_short_bool_cast' => true, | ||
'no_singleline_whitespace_before_semicolons' => true, | ||
'no_spaces_after_function_name' => true, | ||
'no_spaces_inside_parenthesis' => true, | ||
'no_trailing_comma_in_singleline' => true, | ||
'no_trailing_whitespace' => true, | ||
'no_trailing_whitespace_in_comment' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_useless_return' => true, | ||
'no_whitespace_before_comma_in_array' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'normalize_index_brace' => true, | ||
'not_operator_with_successor_space' => false, | ||
'object_operator_without_whitespace' => true, | ||
'phpdoc_indent' => true, | ||
'phpdoc_no_access' => true, | ||
'phpdoc_no_package' => true, | ||
'phpdoc_no_useless_inheritdoc' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_single_line_var_spacing' => true, | ||
'phpdoc_summary' => true, | ||
'phpdoc_to_comment' => true, | ||
'phpdoc_trim' => true, | ||
'phpdoc_types' => true, | ||
'phpdoc_var_without_name' => true, | ||
'self_accessor' => true, | ||
'short_scalar_cast' => true, | ||
'simplified_null_return' => false, // disabled by Shift | ||
'single_blank_line_at_eof' => true, | ||
'single_blank_line_before_namespace' => true, | ||
'single_import_per_statement' => true, | ||
'single_line_after_imports' => true, | ||
'single_line_comment_style' => [ | ||
'comment_types' => ['hash'], | ||
], | ||
'single_quote' => true, | ||
'space_after_semicolon' => true, | ||
'standardize_not_equals' => true, | ||
'switch_case_semicolon_to_colon' => true, | ||
'switch_case_space' => true, | ||
'ternary_operator_spaces' => true, | ||
'trim_array_spaces' => true, | ||
'unary_operator_spaces' => true, | ||
'whitespace_after_comma_in_array' => true, | ||
|
||
// php-cs-fixer 3: Renamed rules | ||
'constant_case' => ['case' => 'lower'], | ||
'general_phpdoc_tag_rename' => true, | ||
'phpdoc_inline_tag_normalizer' => true, | ||
'phpdoc_tag_type' => true, | ||
'psr_autoloading' => true, | ||
'trailing_comma_in_multiline' => false, | ||
|
||
// php-cs-fixer 3: Changed options | ||
'binary_operator_spaces' => [ | ||
'default' => 'single_space', | ||
'operators' => ['=>' => null], | ||
], | ||
'blank_line_before_statement' => [ | ||
'statements' => ['return'], | ||
], | ||
'class_attributes_separation' => [ | ||
'elements' => [ | ||
'const' => 'one', | ||
'method' => 'one', | ||
'property' => 'one', | ||
], | ||
], | ||
'class_definition' => [ | ||
'multi_line_extends_each_single_line' => true, | ||
'single_item_single_line' => true, | ||
'single_line' => true, | ||
], | ||
'ordered_imports' => [ | ||
'sort_algorithm' => 'alpha', | ||
], | ||
|
||
// php-cs-fixer 3: Removed rootless options (*) | ||
'no_unneeded_control_parentheses' => [ | ||
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'], | ||
], | ||
'no_spaces_around_offset' => [ | ||
'positions' => ['inside', 'outside'], | ||
], | ||
'visibility_required' => [ | ||
'elements' => ['property', 'method', 'const'], | ||
], | ||
|
||
]; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in([ | ||
__DIR__.'/app', | ||
__DIR__.'/config', | ||
__DIR__.'/database', | ||
__DIR__.'/resources', | ||
__DIR__.'/routes', | ||
__DIR__.'/tests', | ||
]) | ||
->name('*.php') | ||
->notName('*.blade.php') | ||
->ignoreDotFiles(true) | ||
->ignoreVCS(true); | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setFinder($finder) | ||
->setRules($rules) | ||
->setRiskyAllowed(true) | ||
->setUsingCache(true); |
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 |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# laravel-env-in-aws-ssm | ||
Manage your environment variables in in AWS' SSM Parameter store | ||
> Manage your environment variables in in AWS' SSM Parameter store | ||
Download or upload your .env files into the free [AWS's SSM](https://eu-west-2.console.aws.amazon.com/systems-manager/parameters) store. This allows you to store up to 10,000 keys with sizes up to 4kb. More advanced options are available subject to your [quota](https://docs.aws.amazon.com/general/latest/gr/ssm.html). | ||
|
||
This provides a good companion to referencing env values in cloudformation, serverless framework or to download within runners in other forms of Continuous Deployment processes. | ||
|
||
```shell | ||
composer require nandi95/laravel-env-in-aws-ssm | ||
``` | ||
|
||
This package provides two commands: | ||
```shell | ||
php artisan env:push | ||
php artisan env:pull | ||
``` | ||
|
||
### Arguments: | ||
- `stage` - this is something the equivalent of `production|staging|develop|...`) which identifies what environment the variables are used in. | ||
|
||
- `--appName=`(optional) - this is the name of the current app (equivalent the APP_NAME in the `.env` file normally). If not given, or cannot be found, it will prompt the user for it. | ||
|
||
- `--secretKey=`(optional) - The secret key for the user with the required permissions. If not given, or cannot be found, it will prompt the user for it. | ||
|
||
- `--accessKey=`(optional) - The access key id for the user with the required permissions. If not given, or cannot be found, it will prompt the user for it. | ||
|
||
- `--region=`(optional) - The region the infrastructure resides in. If not given, or cannot be found, it will prompt the user for it. | ||
|
||
--- | ||
|
||
Both commands will use the env file respective to the stage argument. For example: with stage argument `production` it will work with the `.env.production` file. If the file exists when pulling, it will back up the existing file. | ||
|
||
### Parameter <-> environment variable | ||
Keys are transformed in the following manner: | ||
`DB_PASSWORD` => `{appName}/{stage}/DB_PASSWORD` |
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,63 @@ | ||
{ | ||
"name": "nandi95/laravel-env-in-aws-ssm", | ||
"version": "0.1.0", | ||
"description": "Manage your environment variables in in AWS' SSM Parameter store", | ||
"type": "library", | ||
"license": "MIT", | ||
"autoload": { | ||
"psr-4": { | ||
"Nandi95\\LaravelEnvInAwsSsm\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Nandi95\\LaravelEnvInAwsSsm\\EnvInAwsSsmServiceProvider" | ||
] | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Nandor Kraszlan", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require-dev": { | ||
"php": ">=8.0", | ||
"orchestra/testbench": "^7.0", | ||
"phpunit/phpunit": "^9.5", | ||
"roave/security-advisories": "dev-latest", | ||
"friendsofphp/php-cs-fixer": "^3.11", | ||
"phpmd/phpmd": "^2.13", | ||
"phpro/grumphp": "^1.13", | ||
"nunomaduro/larastan": "^2.2" | ||
}, | ||
"require": { | ||
"aws/aws-sdk-php": "^3.235", | ||
"symfony/dotenv": "^6.1" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"phpro/grumphp": true | ||
} | ||
}, | ||
"scripts": { | ||
"post-update-cmd": [ | ||
"Scripts\\ComposerScripts::devModeOnly", | ||
"@php ./vendor/bin/grumphp git:init" | ||
], | ||
"sniff": [ | ||
"./vendor/bin/php-cs-fixer fix -vvv --dry-run --show-progress=dots" | ||
], | ||
"lint": [ | ||
"./vendor/bin/php-cs-fixer fix -vv --show-progress=dots" | ||
], | ||
"phpstan": [ | ||
"./vendor/bin/phpstan analyse --memory-limit=2G" | ||
], | ||
"php-md": [ | ||
"./vendor/bin/phpmd src ansi ./phpmd-ruleset.xml" | ||
] | ||
} | ||
} |
Oops, something went wrong.