Enable cors in laconicd http services #875
@ -115,7 +115,7 @@ def _insert_persistent_peers(config_dir: Path, new_persistent_peers: str):
|
||||
sys.exit(1)
|
||||
with open(config_file_path, "r") as input_file:
|
||||
config_file_content = input_file.read()
|
||||
persistent_peers_pattern = '^persistent_peers = ""'
|
||||
persistent_peers_pattern = r'^persistent_peers = ""'
|
||||
replace_with = f"persistent_peers = \"{new_persistent_peers}\""
|
||||
config_file_content = re.sub(persistent_peers_pattern, replace_with, config_file_content, flags=re.MULTILINE)
|
||||
with open(config_file_path, "w") as output_file:
|
||||
@ -129,7 +129,7 @@ def _enable_cors(config_dir: Path):
|
||||
sys.exit(1)
|
||||
with open(config_file_path, "r") as input_file:
|
||||
config_file_content = input_file.read()
|
||||
cors_pattern = '^cors_allowed_origins = \[]'
|
||||
cors_pattern = r'^cors_allowed_origins = \[]'
|
||||
replace_with = 'cors_allowed_origins = ["*"]'
|
||||
config_file_content = re.sub(cors_pattern, replace_with, config_file_content, flags=re.MULTILINE)
|
||||
with open(config_file_path, "w") as output_file:
|
||||
@ -140,7 +140,7 @@ def _enable_cors(config_dir: Path):
|
||||
sys.exit(1)
|
||||
with open(app_file_path, "r") as input_file:
|
||||
app_file_content = input_file.read()
|
||||
cors_pattern = '^enabled-unsafe-cors = false'
|
||||
cors_pattern = r'^enabled-unsafe-cors = false'
|
||||
replace_with = "enabled-unsafe-cors = true"
|
||||
app_file_content = re.sub(cors_pattern, replace_with, app_file_content, flags=re.MULTILINE)
|
||||
with open(app_file_path, "w") as output_file:
|
||||
|
Loading…
Reference in New Issue
Block a user