feat(registry): add DATA_DIR variable

This commit is contained in:
daimond113 2024-11-03 13:40:06 +01:00
parent 237d6e67e3
commit 32d5f8c517
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
3 changed files with 9 additions and 3 deletions

View file

@ -113,6 +113,10 @@ for this purpose.
index repository.\ index repository.\
Example: `pesde@localhost` Example: `pesde@localhost`
- **DATA_DIR**: The directory where the registry stores miscellaneous data.
This value can use `{CWD}` to refer to the current working directory.\
Default: `{CWD}/data`
- **ADDRESS**: The address to bind the server to.\ - **ADDRESS**: The address to bind the server to.\
Default: `127.0.0.1` Default: `127.0.0.1`

View file

@ -6,6 +6,8 @@ GIT_PASSWORD= # password of the account (PAT for GitHub)
COMMITTER_GIT_NAME= # name of the committer used for index updates COMMITTER_GIT_NAME= # name of the committer used for index updates
COMMITTER_GIT_EMAIL= # email of the committer used for index updates COMMITTER_GIT_EMAIL= # email of the committer used for index updates
DATA_DIR= # directory where miscellaneous data is stored
# AUTHENTICATION CONFIGURATION # AUTHENTICATION CONFIGURATION
# Set the variables of the authentication you want to use in order to enable it # Set the variables of the authentication you want to use in order to enable it

View file

@ -85,7 +85,7 @@ async fn run() -> std::io::Result<()> {
let port: u16 = benv!(parse "PORT" => "8080"); let port: u16 = benv!(parse "PORT" => "8080");
let cwd = current_dir().unwrap(); let cwd = current_dir().unwrap();
let data_dir = cwd.join("data"); let data_dir = PathBuf::from(benv!("DATA_DIR" => "{CWD}/data").replace("{CWD}", cwd.to_str().unwrap()));
fs_err::create_dir_all(&data_dir).unwrap(); fs_err::create_dir_all(&data_dir).unwrap();
let project = Project::new( let project = Project::new(