-
Notifications
You must be signed in to change notification settings - Fork 0
docs: add doc comments, fix rustdoc links, serve docs over HTTP #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||||||||||||||||||||||||||||
| ## —— Documentation (cargo doc) ---------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| DOC_PORT ?= 8765 | ||||||||||||||||||||||||||||||||||||
| DOC_DIR := target/doc | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| .PHONY: doc | ||||||||||||||||||||||||||||||||||||
| doc: ## Generate Rust API documentation (HTML in target/doc) | ||||||||||||||||||||||||||||||||||||
| @echo "📚 Building Rust API documentation..." | ||||||||||||||||||||||||||||||||||||
| cargo doc --workspace --no-deps | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| .PHONY: doc-serve | ||||||||||||||||||||||||||||||||||||
| doc-serve: doc ## Serve docs at http://127.0.0.1:$(DOC_PORT)/ (links work correctly) | ||||||||||||||||||||||||||||||||||||
| @echo "📖 Serving docs at http://127.0.0.1:$(DOC_PORT)/ (Ctrl+C to stop)" | ||||||||||||||||||||||||||||||||||||
| @cd $(DOC_DIR) && python3 -m http.server $(DOC_PORT) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| .PHONY: doc-open | ||||||||||||||||||||||||||||||||||||
| doc-open: doc ## Generate docs, serve locally, and open in browser (fixes broken file:// links) | ||||||||||||||||||||||||||||||||||||
| @echo "📖 Starting local doc server and opening browser..." | ||||||||||||||||||||||||||||||||||||
| @if [ ! -d "$(DOC_DIR)" ]; then echo "No $(DOC_DIR); run make doc"; exit 1; fi; \ | ||||||||||||||||||||||||||||||||||||
| ( cd $(DOC_DIR) && nohup python3 -m http.server $(DOC_PORT) </dev/null >/dev/null 2>&1 & ); \ | ||||||||||||||||||||||||||||||||||||
| sleep 1; \ | ||||||||||||||||||||||||||||||||||||
| (xdg-open "http://127.0.0.1:$(DOC_PORT)/rustfs/" 2>/dev/null || open "http://127.0.0.1:$(DOC_PORT)/rustfs/" 2>/dev/null) \ | ||||||||||||||||||||||||||||||||||||
| || echo "Open http://127.0.0.1:$(DOC_PORT)/rustfs/ in your browser"; \ | ||||||||||||||||||||||||||||||||||||
| echo "Docs: http://127.0.0.1:$(DOC_PORT)/ — stop server with: pkill -f 'python3 -m http.server $(DOC_PORT)'" | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+24
|
||||||||||||||||||||||||||||||||||||
| ( cd $(DOC_DIR) && nohup python3 -m http.server $(DOC_PORT) </dev/null >/dev/null 2>&1 & ); \ | |
| sleep 1; \ | |
| (xdg-open "http://127.0.0.1:$(DOC_PORT)/rustfs/" 2>/dev/null || open "http://127.0.0.1:$(DOC_PORT)/rustfs/" 2>/dev/null) \ | |
| || echo "Open http://127.0.0.1:$(DOC_PORT)/rustfs/ in your browser"; \ | |
| echo "Docs: http://127.0.0.1:$(DOC_PORT)/ — stop server with: pkill -f 'python3 -m http.server $(DOC_PORT)'" | |
| ( cd $(DOC_DIR) && \ | |
| nohup python3 -m http.server $(DOC_PORT) </dev/null >/dev/null 2>doc-open-server.err & \ | |
| echo $$! > .doc-open.pid ); \ | |
| sleep 1; \ | |
| SERVER_PID=$$(cat $(DOC_DIR)/.doc-open.pid 2>/dev/null || echo ""); \ | |
| if [ -z "$$SERVER_PID" ]; then \ | |
| echo "Failed to start docs server. See $(DOC_DIR)/doc-open-server.err for details."; \ | |
| exit 1; \ | |
| fi; \ | |
| (xdg-open "http://127.0.0.1:$(DOC_PORT)/rustfs/" 2>/dev/null || open "http://127.0.0.1:$(DOC_PORT)/rustfs/" 2>/dev/null) \ | |
| || echo "Open http://127.0.0.1:$(DOC_PORT)/rustfs/ in your browser"; \ | |
| echo "Docs: http://127.0.0.1:$(DOC_PORT)/ — server PID: $$SERVER_PID — stop server with: kill $$SERVER_PID" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,25 +89,25 @@ pub const RUSTFS_CA_CERT: &str = "ca.crt"; | |
| /// Default HTTP prefix for rustfs | ||
| /// This is the default HTTP prefix for rustfs. | ||
| /// It is used to identify HTTP URLs. | ||
| /// Default value: http:// | ||
| /// Default value: <http://> | ||
| pub const RUSTFS_HTTP_PREFIX: &str = "http://"; | ||
|
|
||
| /// Default HTTPS prefix for rustfs | ||
| /// This is the default HTTPS prefix for rustfs. | ||
| /// It is used to identify HTTPS URLs. | ||
| /// Default value: https:// | ||
| /// Default value: <https://> | ||
| pub const RUSTFS_HTTPS_PREFIX: &str = "https://"; | ||
|
Comment on lines
89
to
99
|
||
|
|
||
| /// Default documentation URL for rustfs | ||
| /// This is the default documentation URL for rustfs. | ||
| /// It is used to provide the documentation of the application. | ||
| /// Default value: https://docs.rustfs.com | ||
| /// Default value: <https://docs.rustfs.com> | ||
| pub const RUSTFS_DOCS_URL: &str = "https://docs.rustfs.com"; | ||
|
|
||
| /// Default GitHub URL for rustfs | ||
| /// This is the default GitHub URL for rustfs. | ||
| /// It is used to provide the source code of the application. | ||
| /// Default value: https://github.com/rustfs/rustfs | ||
| /// Default value: <https://github.com/rustfs/rustfs> | ||
| pub const RUSTFS_GITHUB_URL: &str = "https://github.com/rustfs/rustfs"; | ||
|
|
||
| /// Default license for rustfs | ||
|
|
@@ -119,7 +119,7 @@ pub const RUSTFS_LICENSE: &str = "Apache-2.0"; | |
| /// Default license URL for rustfs | ||
| /// This is the default license URL for rustfs. | ||
| /// It is used to provide the license URL of the application. | ||
| /// Default value: https://www.apache.org/licenses/LICENSE-2.0 | ||
| /// Default value: <https://www.apache.org/licenses/LICENSE-2.0> | ||
| pub const RUSTFS_LICENSE_URL: &str = "https://www.apache.org/licenses/LICENSE-2.0"; | ||
|
|
||
| /// Environment variable for rustfs address | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python3 -m http.serverbinds to0.0.0.0by default, but the target description/echo text says it serves at127.0.0.1. To avoid exposing the docs server on all interfaces, pass an explicit bind address (and keep the printed URL consistent).