10
10
11
11
METABLOCK_SPACE = os .environ .get ("METABLOCK_SPACE" , "" )
12
12
METABLOCK_ENV = os .environ .get ("METABLOCK_ENV" , "prod" )
13
+ METABLOCK_NAME = os .environ .get ("METABLOCK_NAME" , "shipped from metablock-py" )
13
14
METABLOCK_BLOCK_ID = os .environ .get ("METABLOCK_BLOCK_ID" , "" )
14
15
METABLOCK_API_TOKEN = os .environ .get ("METABLOCK_API_TOKEN" , "" )
15
16
@@ -32,11 +33,19 @@ def main() -> None:
32
33
default = METABLOCK_SPACE ,
33
34
show_default = True ,
34
35
)
35
- @click .option ("--token" , help = "metablock API token" , default = METABLOCK_API_TOKEN )
36
+ @click .option (
37
+ "--token" ,
38
+ help = "metablock API token" ,
39
+ default = METABLOCK_API_TOKEN ,
40
+ )
36
41
def apply (path : str , space_name : str , token : str ) -> None :
37
42
"""Apply metablock manifest to a metablock space"""
38
43
asyncio .get_event_loop ().run_until_complete (
39
- _apply (path , space_name or METABLOCK_SPACE , token or METABLOCK_API_TOKEN )
44
+ _apply (
45
+ path ,
46
+ space_name or METABLOCK_SPACE ,
47
+ token or METABLOCK_API_TOKEN ,
48
+ )
40
49
)
41
50
42
51
@@ -58,14 +67,30 @@ def apply(path: str, space_name: str, token: str) -> None:
58
67
@click .option (
59
68
"--name" ,
60
69
help = "Optional deployment name" ,
61
- default = "shipped from metablock-py" ,
70
+ default = METABLOCK_NAME ,
62
71
show_default = True ,
63
72
)
64
- @click .option ("--token" , help = "metablock API token" , default = METABLOCK_API_TOKEN )
65
- def ship (path : str , env : str , block_id : str , name : str , token : str ) -> None :
73
+ @click .option (
74
+ "--token" ,
75
+ help = "metablock API token" ,
76
+ default = METABLOCK_API_TOKEN ,
77
+ )
78
+ def ship (
79
+ path : str ,
80
+ env : str ,
81
+ block_id : str ,
82
+ name : str ,
83
+ token : str ,
84
+ ) -> None :
66
85
"""Deploy a new version of html block"""
67
86
asyncio .get_event_loop ().run_until_complete (
68
- _ship (path , env , block_id , name , token or METABLOCK_API_TOKEN )
87
+ _ship (
88
+ path ,
89
+ env or METABLOCK_ENV ,
90
+ block_id or METABLOCK_BLOCK_ID ,
91
+ name or METABLOCK_NAME ,
92
+ token or METABLOCK_API_TOKEN ,
93
+ )
69
94
)
70
95
71
96
0 commit comments