Skip to content

Commit 1b71236

Browse files
committed
Fix: Wrap ALAS's config_redirect()
1 parent abfd00d commit 1b71236

1 file changed

Lines changed: 24 additions & 19 deletions

File tree

deploy/config.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,6 @@ def __init__(self, file=DEPLOY_CONFIG):
7474
self.file = file
7575
self.config = {}
7676
self.read()
77-
if self.Repository in [
78-
'https://gitee.com/LmeSzinc/AzurLaneAutoScript',
79-
'https://gitee.com/lmeszinc/azur-lane-auto-script-mirror',
80-
'https://e.coding.net/llop18870/alas/AzurLaneAutoScript.git',
81-
'https://e.coding.net/saarcenter/alas/AzurLaneAutoScript.git',
82-
'https://git.saarcenter.com/LmeSzinc/AzurLaneAutoScript.git',
83-
]:
84-
self.Repository = 'git://git.lyoko.io/AzurLaneAutoScript'
85-
86-
# Bypass webui.config.DeployConfig.__setattr__()
87-
# Don't write these into deploy.yaml
88-
super().__setattr__(
89-
'GitOverCdn',
90-
self.Repository == 'git://git.lyoko.io/AzurLaneAutoScript' and self.Branch == 'master'
91-
)
92-
if self.Repository in ['global']:
93-
super().__setattr__('Repository', 'https://github.com/LmeSzinc/AzurLaneAutoScript')
94-
if self.Repository in ['cn']:
95-
super().__setattr__('Repository', 'git://git.lyoko.io/AzurLaneAutoScript')
9677

9778
self.write()
9879
self.show_config()
@@ -120,6 +101,30 @@ def read(self):
120101
def write(self):
121102
poor_yaml_write(self.config, self.file)
122103

104+
def config_redirect(self):
105+
"""
106+
Redirect deploy config, must be called after each `read()`
107+
"""
108+
if self.Repository in [
109+
'https://gitee.com/LmeSzinc/AzurLaneAutoScript',
110+
'https://gitee.com/lmeszinc/azur-lane-auto-script-mirror',
111+
'https://e.coding.net/llop18870/alas/AzurLaneAutoScript.git',
112+
'https://e.coding.net/saarcenter/alas/AzurLaneAutoScript.git',
113+
'https://git.saarcenter.com/LmeSzinc/AzurLaneAutoScript.git',
114+
]:
115+
self.Repository = 'git://git.lyoko.io/AzurLaneAutoScript'
116+
117+
# Bypass webui.config.DeployConfig.__setattr__()
118+
# Don't write these into deploy.yaml
119+
super().__setattr__(
120+
'GitOverCdn',
121+
self.Repository == 'git://git.lyoko.io/AzurLaneAutoScript' and self.Branch == 'master'
122+
)
123+
if self.Repository in ['global']:
124+
super().__setattr__('Repository', 'https://github.com/LmeSzinc/AzurLaneAutoScript')
125+
if self.Repository in ['cn']:
126+
super().__setattr__('Repository', 'git://git.lyoko.io/AzurLaneAutoScript')
127+
123128
def filepath(self, key):
124129
"""
125130
Args:

0 commit comments

Comments
 (0)