Skip to content

Commit

Permalink
feat: newfile infer default to true
Browse files Browse the repository at this point in the history
  • Loading branch information
SolaWing committed Apr 10, 2024
1 parent 9729be9 commit 4a286a5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions config/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ def on(self, value: str):
except Exception:
return False

def on_key(self, key: str, default = False):
if value := os.environ.get(key):
return self.on(value)
return default

@property
@cache
def new_file(self):
if newfile := os.environ.get("XBS_FEAT_NEWFILE"):
return self.on(newfile)
return False
return self.on_key("XBS_FEAT_NEWFILE", default=True)

env = Env()

0 comments on commit 4a286a5

Please sign in to comment.