File tree 3 files changed +24
-30
lines changed
3 files changed +24
-30
lines changed Original file line number Diff line number Diff line change 6
6
7
7
from cli import utils
8
8
from cli .constants import BASE_DIR , CONFIG_PATH , FULL_COMPOSE_PATH , BASE_COMPOSE_FILE
9
+ from cli .options import with_external_services_option
9
10
10
11
11
12
@click .command (help = 'Initialize ForcAD configuration' )
12
- @click .option (
13
- '--redis' ,
14
- metavar = 'ADDR' ,
15
- help = 'External redis address (disables built-in redis container)' ,
16
- )
17
- @click .option (
18
- '--database' ,
19
- metavar = 'ADDR' ,
20
- help = 'External Postgres address (disables built-in postgres container)' ,
21
- )
22
- @click .option (
23
- '--rabbitmq' ,
24
- metavar = 'ADDR' ,
25
- help = 'External RabbitMQ address (disables built-in rabbitmq container)' ,
26
- )
13
+ @with_external_services_option
27
14
def setup (redis , database , rabbitmq , ** _kwargs ):
28
15
override_config (redis = redis , database = database , rabbitmq = rabbitmq )
29
16
config = utils .load_config ()
Original file line number Diff line number Diff line change 4
4
from cli import utils
5
5
from cli .base .setup import override_config
6
6
from cli .constants import SECRETS_DIR , KUSTOMIZATION_BASE_PATH , KUSTOMIZATION_PATH
7
+ from cli .options import with_external_services_option
7
8
from .utils import write_secret
8
9
9
10
10
11
@click .command (help = 'Initialize ForcAD configuration' )
11
- @click .option (
12
- '--redis' ,
13
- metavar = 'ADDR' ,
14
- help = 'External redis address (disables built-in redis container)' ,
15
- )
16
- @click .option (
17
- '--database' ,
18
- metavar = 'ADDR' ,
19
- help = 'External Postgres address (disables built-in postgres container)' ,
20
- )
21
- @click .option (
22
- '--rabbitmq' ,
23
- metavar = 'ADDR' ,
24
- help = 'External RabbitMQ address (disables built-in rabbitmq container)' ,
25
- )
12
+ @with_external_services_option
26
13
def setup (redis , database , rabbitmq , ** _kwargs ):
27
14
override_config (redis = redis , database = database , rabbitmq = rabbitmq )
28
15
config = utils .load_config ()
Original file line number Diff line number Diff line change @@ -17,3 +17,23 @@ def with_workers_option(func):
17
17
default = 1 ,
18
18
help = 'Number of celery worker instances' ,
19
19
)(func )
20
+
21
+
22
+ def with_external_services_option (func ):
23
+ wrapped = click .option (
24
+ '--redis' ,
25
+ metavar = 'ADDR' ,
26
+ help = 'External redis address (disables built-in redis container)' ,
27
+ )(func )
28
+ wrapped = click .option (
29
+ '--database' ,
30
+ metavar = 'ADDR' ,
31
+ help = 'External Postgres address (disables built-in postgres container)' ,
32
+ )(wrapped )
33
+ wrapped = click .option (
34
+ '--rabbitmq' ,
35
+ metavar = 'ADDR' ,
36
+ help = 'External RabbitMQ address (disables built-in rabbitmq container)' ,
37
+ )(wrapped )
38
+
39
+ return wrapped
You can’t perform that action at this time.
0 commit comments