|
|
@@ -18,11 +18,7 @@ def get_bucket_configs_dict(buckets, clusters, users):
|
|
|
# logger.info(bucket_name)
|
|
|
# logger.info(endpoint)
|
|
|
# logger.info(user_config)
|
|
|
- bucket_config = {
|
|
|
- "endpoint": endpoint,
|
|
|
- "ak": user_config["ak"],
|
|
|
- "sk": user_config["sk"],
|
|
|
- }
|
|
|
+ bucket_config = [user_config["ak"], user_config["sk"], endpoint]
|
|
|
bucket_configs[bucket_name] = bucket_config
|
|
|
|
|
|
return bucket_configs
|
|
|
@@ -32,16 +28,10 @@ def write_json_to_home(my_dict):
|
|
|
# Convert dictionary to JSON
|
|
|
json_data = json.dumps(my_dict, indent=4, ensure_ascii=False)
|
|
|
|
|
|
- # Determine the home directory path based on the operating system
|
|
|
- if os.name == "posix": # Linux or macOS
|
|
|
- home_dir = os.path.expanduser("~")
|
|
|
- elif os.name == "nt": # Windows
|
|
|
- home_dir = os.path.expandvars("%USERPROFILE%")
|
|
|
- else:
|
|
|
- raise Exception("Unsupported operating system")
|
|
|
+ home_dir = os.path.expanduser("~")
|
|
|
|
|
|
# Define the output file path
|
|
|
- output_file = os.path.join(home_dir, "magic_pdf_config.json")
|
|
|
+ output_file = os.path.join(home_dir, "magic-pdf.json")
|
|
|
|
|
|
# Write JSON data to the output file
|
|
|
with open(output_file, "w") as f:
|
|
|
@@ -54,4 +44,8 @@ def write_json_to_home(my_dict):
|
|
|
if __name__ == '__main__':
|
|
|
bucket_configs_dict = get_bucket_configs_dict(s3_buckets, s3_clusters, s3_users)
|
|
|
logger.info(bucket_configs_dict)
|
|
|
- write_json_to_home(bucket_configs_dict)
|
|
|
+ config_dict = {
|
|
|
+ "bucket_info": bucket_configs_dict,
|
|
|
+ "temp-output-dir": "/tmp"
|
|
|
+ }
|
|
|
+ write_json_to_home(config_dict)
|