Tony-ooo commited on
Commit
f4ff108
·
1 Parent(s): dfa7ce8

Improve password security by using environment variables with fallback to default password

Browse files
Files changed (2) hide show
  1. README.md +9 -0
  2. start_server.sh +2 -2
README.md CHANGED
@@ -26,8 +26,17 @@ This space runs VSCode in a Docker container with a web interface.
26
  2. Access VSCode through the generated URL
27
  3. Default password/token is `huggingface`
28
 
 
 
 
 
 
 
29
  ## Troubleshooting
30
  - If you see a warning about NVIDIA Driver not being detected, this is normal when running in certain environments. GPU functionality will be available when the container is run with proper NVIDIA Container Toolkit support.
31
  - If you get an error about missing password, make sure the PASSWORD environment variable is set or a password is configured in the code-server config file.
32
 
 
 
 
33
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
26
  2. Access VSCode through the generated URL
27
  3. Default password/token is `huggingface`
28
 
29
+ ## Custom Password
30
+ To set a custom password:
31
+ 1. Go to your Space settings
32
+ 2. Add a "Space secret" with key `PASSWORD` and your desired password as the value
33
+ 3. Restart the Space for changes to take effect
34
+
35
  ## Troubleshooting
36
  - If you see a warning about NVIDIA Driver not being detected, this is normal when running in certain environments. GPU functionality will be available when the container is run with proper NVIDIA Container Toolkit support.
37
  - If you get an error about missing password, make sure the PASSWORD environment variable is set or a password is configured in the code-server config file.
38
 
39
+ ## Security
40
+ For better security, use Space secrets to set your password instead of hardcoding it in the files. This prevents the password from being exposed in the repository.
41
+
42
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
start_server.sh CHANGED
@@ -2,8 +2,8 @@
2
  # Create data directory if it doesn't exist
3
  mkdir -p /data
4
 
5
- # Set password as environment variable
6
- export PASSWORD="huggingface"
7
 
8
  # Generate code-server config
9
  mkdir -p ~/.config/code-server
 
2
  # Create data directory if it doesn't exist
3
  mkdir -p /data
4
 
5
+ # Set password from environment variable, with fallback to default
6
+ export PASSWORD="${PASSWORD:-huggingface}"
7
 
8
  # Generate code-server config
9
  mkdir -p ~/.config/code-server