thinhvv commited on
Commit
855b960
·
verified ·
1 Parent(s): 8b1e4f7

Update init.py

Browse files
Files changed (1) hide show
  1. init.py +5 -7
init.py CHANGED
@@ -15,9 +15,7 @@ st.set_page_config(
15
  # --------------------------------------------------
16
  # Secrets: Repository and GitHub Credentials
17
  # --------------------------------------------------
18
- # REPO_NAME: name of the GitHub repository to clone
19
- # PRV_REPO: subdirectory inside the cloned repository where the app resides
20
- repo_name = st.secrets["REPO_NAME"] # e.g. "my-main-repo"
21
  private_repo = st.secrets["PRV_REPO"] # e.g. "private_app"
22
  git_user = st.secrets["GIT_USR"]
23
  git_token = st.secrets["GIT_TK"]
@@ -25,10 +23,10 @@ git_token = st.secrets["GIT_TK"]
25
  def clone_private_repo():
26
  """
27
  Clone the GitHub repository if it hasn't been cloned already.
28
- The repository will be cloned into a folder named after `repo_name`.
29
  """
30
- repo_url = f"https://{git_user}:{git_token}@github.com/{git_user}/{repo_name}.git"
31
- if not os.path.exists(repo_name):
32
  print("Cloning repository...")
33
  subprocess.run(["git", "clone", repo_url], check=True)
34
  else:
@@ -76,7 +74,7 @@ try:
76
 
77
  # Step 2: Change directory into the cloned repository folder,
78
  # then into the subdirectory that contains your app.
79
- os.chdir(repo_name)
80
  os.chdir(private_repo)
81
 
82
  # (Optional) List files to verify the directory structure (console output only)
 
15
  # --------------------------------------------------
16
  # Secrets: Repository and GitHub Credentials
17
  # --------------------------------------------------
18
+
 
 
19
  private_repo = st.secrets["PRV_REPO"] # e.g. "private_app"
20
  git_user = st.secrets["GIT_USR"]
21
  git_token = st.secrets["GIT_TK"]
 
23
  def clone_private_repo():
24
  """
25
  Clone the GitHub repository if it hasn't been cloned already.
26
+ The repository will be cloned into a folder named after `private_repo`.
27
  """
28
+ repo_url = f"https://{git_user}:{git_token}@github.com/{git_user}/{private_repo}.git"
29
+ if not os.path.exists(private_repo):
30
  print("Cloning repository...")
31
  subprocess.run(["git", "clone", repo_url], check=True)
32
  else:
 
74
 
75
  # Step 2: Change directory into the cloned repository folder,
76
  # then into the subdirectory that contains your app.
77
+ os.chdir(private_repo)
78
  os.chdir(private_repo)
79
 
80
  # (Optional) List files to verify the directory structure (console output only)