1010
1111METABLOCK_SPACE = os .environ .get ("METABLOCK_SPACE" , "" )
1212METABLOCK_ENV = os .environ .get ("METABLOCK_ENV" , "prod" )
13+ METABLOCK_NAME = os .environ .get ("METABLOCK_NAME" , "shipped from metablock-py" )
1314METABLOCK_BLOCK_ID = os .environ .get ("METABLOCK_BLOCK_ID" , "" )
1415METABLOCK_API_TOKEN = os .environ .get ("METABLOCK_API_TOKEN" , "" )
1516
@@ -32,11 +33,19 @@ def main() -> None:
3233 default = METABLOCK_SPACE ,
3334 show_default = True ,
3435)
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+ )
3641def apply (path : str , space_name : str , token : str ) -> None :
3742 """Apply metablock manifest to a metablock space"""
3843 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+ )
4049 )
4150
4251
@@ -58,14 +67,30 @@ def apply(path: str, space_name: str, token: str) -> None:
5867@click .option (
5968 "--name" ,
6069 help = "Optional deployment name" ,
61- default = "shipped from metablock-py" ,
70+ default = METABLOCK_NAME ,
6271 show_default = True ,
6372)
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 :
6685 """Deploy a new version of html block"""
6786 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+ )
6994 )
7095
7196
0 commit comments