Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
hhit
config-generator
Commits
a100ff15
Commit
a100ff15
authored
Feb 21, 2021
by
Hendrik Heneke
Browse files
Initial version.
parents
Pipeline
#360
passed with stage
in 26 seconds
Changes
46
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
142 additions
and
0 deletions
+142
-0
src/Resources/config/services.yaml
src/Resources/config/services.yaml
+36
-0
tests/ConfigGeneratorBundleTest.php
tests/ConfigGeneratorBundleTest.php
+48
-0
tests/cfgen.json
tests/cfgen.json
+14
-0
tests/templates/users.json.hbs
tests/templates/users.json.hbs
+13
-0
tests/templates/users.yaml.hbs
tests/templates/users.yaml.hbs
+9
-0
tests/values/users.values.json
tests/values/users.values.json
+22
-0
No files found.
src/Resources/config/services.yaml
0 → 100644
View file @
a100ff15
services
:
_defaults
:
autowire
:
true
autoconfigure
:
true
HHIT\ConfigGeneratorBundle\Generator\Definition\DefinitionReader
:
public
:
true
arguments
:
$projectDir
:
'
%kernel.project_dir%'
HHIT\ConfigGeneratorBundle\Generator\Secrets\SymfonyVaultSecretProvider
:
public
:
true
arguments
:
$sodiumVault
:
'
@secrets.vault'
$dotenvVault
:
'
@secrets.local_vault'
HHIT\ConfigGeneratorBundle\Generator\Secrets\SecretProviderFactory
:
public
:
true
arguments
:
$symfonyProvider
:
'
@HHIT\ConfigGeneratorBundle\Generator\Secrets\SymfonyVaultSecretProvider'
HHIT\ConfigGeneratorBundle\Generator\Values\ValuesLoaderFactory
:
public
:
true
arguments
:
$secretProviderFactory
:
'
@HHIT\ConfigGeneratorBundle\Generator\Secrets\SecretProviderFactory'
HHIT\ConfigGeneratorBundle\Generator\Validator\ValidatorFactory
:
public
:
true
HHIT\ConfigGeneratorBundle\Generator\Generator
:
public
:
true
arguments
:
$definitionReader
:
'
@HHIT\ConfigGeneratorBundle\Generator\Definition\DefinitionReader'
$valuesLoaderFactory
:
'
@HHIT\ConfigGeneratorBundle\Generator\Values\ValuesLoaderFactory'
$validatorFactory
:
'
@HHIT\ConfigGeneratorBundle\Generator\Validator\ValidatorFactory'
HHIT\ConfigGeneratorBundle\Command\GenerateConfigsCommand
:
public
:
true
tags
:
-
{
name
:
'
console.command'
,
command
:
'
cfgen:generate-configs'
}
arguments
:
$generator
:
'
@HHIT\ConfigGeneratorBundle\Generator\Generator'
tests/ConfigGeneratorBundleTest.php
0 → 100644
View file @
a100ff15
<?php
declare
(
strict_types
=
1
);
namespace
HHIT\ConfigGeneratorBundle\Tests\Command
;
use
HHIT\ConfigGeneratorBundle\Command\GenerateConfigsCommand
;
use
HHIT\ConfigGeneratorBundle\Generator\Definition\DefinitionReader
;
use
HHIT\ConfigGeneratorBundle\Generator\IO\ReaderFactory
;
use
HHIT\ConfigGeneratorBundle\Generator\Generator
;
use
HHIT\ConfigGeneratorBundle\Generator\Secrets\SecretProviderFactory
;
use
HHIT\ConfigGeneratorBundle\Generator\Secrets\SymfonyVaultSecretProvider
;
use
HHIT\ConfigGeneratorBundle\Generator\Validator\ValidatorFactory
;
use
HHIT\ConfigGeneratorBundle\Generator\Values\ValuesLoaderFactory
;
use
Symfony\Bundle\FrameworkBundle\Test\KernelTestCase
;
class
ConfigGeneratorBundleTest
extends
KernelTestCase
{
/**
* @before
*/
public
static
function
before
()
{
self
::
bootKernel
();
}
function
dependencies
()
{
return
[
'definition-reader'
=>
[
DefinitionReader
::
class
],
'symfony-vault-secret-provider'
=>
[
SymfonyVaultSecretProvider
::
class
],
'secret-provider-factory'
=>
[
SecretProviderFactory
::
class
],
'values-loader-factory'
=>
[
ValuesLoaderFactory
::
class
],
'validator-factory'
=>
[
ValidatorFactory
::
class
],
'processor'
=>
[
Generator
::
class
],
'generate-configs-command'
=>
[
GenerateConfigsCommand
::
class
]
];
}
/**
* @test
* @dataProvider dependencies
*/
function
dependencyConfigured
(
$id
)
{
$this
->
assertNotNull
(
self
::
$container
->
get
(
$id
));
}
}
tests/cfgen.json
0 → 100644
View file @
a100ff15
{
"users.json"
:
{
"template"
:
"./templates/users.json.hbs"
,
"type"
:
"json"
,
"values"
:
"./values/users.values.json"
,
"destination"
:
"var/users.json"
},
"users.yaml"
:
{
"template"
:
"./templates/users.yaml.hbs"
,
"type"
:
"yaml"
,
"values"
:
"./values/users.values.json"
,
"destination"
:
"var/users.yaml"
}
}
tests/templates/users.json.hbs
0 → 100644
View file @
a100ff15
{
"users": {
{{#
each
users
}}
"
{{
this
.
username
}}
": {
"username": "
{{
this
.
username
}}
",
"password": "
{{
password_hash_bcrypt
this
.
password
}}
",
"cleartextPassword": "
{{
this
.
password
}}
"
}
{{#
unless
@last
}}
,
{{/
unless
}}
{{/
each
}}
},
"version": 2,
"secret": "
{{
secret
}}
"
}
tests/templates/users.yaml.hbs
0 → 100644
View file @
a100ff15
users:
{{#
each
users
}}
-
{{
this
.
username
}}
:
username: '
{{
this
.
username
}}
'
password: '
{{
password_hash_bcrypt
this
.
password
}}
'
cleartextPassword: '
{{
this
.
password
}}
'
{{/
each
}}
version: 2
secret: '
{{
this
.
secret
}}
'
tests/values/users.values.json
0 → 100644
View file @
a100ff15
{
"users"
:
[
{
"username"
:
"admin"
,
"password"
:
{
"$type"
:
"secret"
,
"arg"
:
"admin_password"
}
},
{
"username"
:
"operator"
,
"password"
:
{
"$type"
:
"secret"
,
"arg"
:
"operator_password"
}
}
],
"secret"
:
{
"$type"
:
"secret"
,
"arg"
:
"secret"
}
}
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment