feat(config): add automatic bucket creation on startup (Issue #1027)
This PR implements automatic bucket creation on server startup, addressing Issue #1027.
Changes
- Config: Added
--default-bucketsCLI argument withRUSTFS_DEFAULT_BUCKETSenv var - Startup: Buckets are created during server initialization before metadata system starts
Usage
# Environment variable
RUSTFS_DEFAULT_BUCKETS=data,logs,backup rustfs /data
# CLI argument
rustfs --default-buckets "data,logs,backup" /data
Features
- Validates bucket names using existing check_valid_bucket_name_strict()
- Gracefully handles existing buckets (logs info, continues)
- Invalid bucket names are skipped with warning
- Does not fail startup on errors
Verified with cargo clippy and cargo test -p rustfs.
Closes #1027
Hey @Jack-GitHub12 ,
Thank you for your contribution!
@jackulau Please improve, Thank You!
I've reviewed the image, and i noticed that the automated bucket creation is being performed using mc.
A much better solution would be to avoid placing core functionality like this directly within RustFS.
Implementing automatic creation within the core codebase is neither secure nor reasonable. This feature should instead be handled by third-party tooling or a mirror/wrapper application, rather than residing inside the core RustFS library itself.
Hey @jackulau ,
Thank you for your contribution!
What are your thoughts on @myrust-go opinion?