feat: Set default site using FRAPPE_SITE env var
Default site can now be set using the environment variable FRAPPE_SITE An attempt to deprecate the use of currentsite.txt
This commit is contained in:
parent
40d3db402a
commit
b181b69894
2 changed files with 9 additions and 0 deletions
|
|
@ -382,3 +382,10 @@ class TestCommands(BaseTestCommands):
|
|||
|
||||
os.remove(test1_path)
|
||||
os.remove(test2_path)
|
||||
|
||||
def test_frappe_site_env(self):
|
||||
os.putenv('FRAPPE_SITE', frappe.local.site)
|
||||
self.execute("bench execute frappe.ping")
|
||||
self.assertEquals(self.returncode, 0)
|
||||
self.assertIn("pong", self.stdout)
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ def get_sites(site_arg):
|
|||
return frappe.utils.get_sites()
|
||||
elif site_arg:
|
||||
return [site_arg]
|
||||
elif os.environ.get('FRAPPE_SITE'):
|
||||
return [os.environ.get('FRAPPE_SITE')]
|
||||
elif os.path.exists('currentsite.txt'):
|
||||
with open('currentsite.txt') as f:
|
||||
site = f.read().strip()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue