5 个版本
0.1.5 | 2022 年 3 月 22 日 |
---|---|
0.1.4 | 2022 年 2 月 25 日 |
0.1.3 | 2022 年 2 月 22 日 |
0.1.1 | 2022 年 2 月 22 日 |
0.1.0 | 2022 年 2 月 22 日 |
1153 在 HTTP 服务器
260KB
6K SLoC
msg-store-http-server
一个 HTTP 服务器,用于公开 msg-store API 以供更广泛的应用程序使用
入门
$ cargo install msg-store-http-server
$ msg-store-http-server
或使用选项标志
$ msg-store-http-server --node-id=12345 --database=leveldb --leveldb-path=/path/to/leveldb/dir --file-storage-path=/path/to/filestorage/dir
或使用默认配置文件 $HOME/.msg-store/config.json
$ msg-store-http-server -c
或使用自定义路径的配置文件
$ msg-store-http-server --config-path=/path/to/config/file
使用 -c 标志在 $HOME/.msg-store/config.json 中创建的默认配置文件
{
"host": "127.0.0.1",
"port": 8080,
"node_id": null,
"database": "mem",
"leveldb_path": null,
"file_storage": false,
"file_storage_path": null,
"max_byte_size": null,
"groups": null,
"no_update": null,
"update": true
}
节点 ID
节点 ID 可以是任何无符号 32 位整数,默认值为 0。
$ msg-store-http-server --node-id=12345
数据库
默认数据库是包含的内存数据库。
要使用 leveldb,请传递数据库标志到应用程序或更改 config.json 文件中的数据库属性。这将在 $HOME/.msg-store 目录中创建一个 leveldb 目录。
$ msg-store-http-server --database=leveldb
要设置自定义路径到 leveldb,请使用 --leveldb-path 标志或更改 config.json 中的 leveldb_path 属性。如果不存在数据库,将会创建。leveldb 插件使用 2 个 leveldb 实例,因此路径应该是目录。
$ msg-store-http-server --database=leveldb --leveldb-path=/path/to/leveldb/dir
文件存储
要使用大型消息的文件存储功能,请传递 --file-storage 标志或将 config.json 中的 file_storage 属性设置为 true。这将在 $HOME/.msg-store 目录中创建一个文件存储目录。
$ msg-store-http-server --file-storage
要设置自定义路径,请传递 --file-storage-path 标志或将 config.json 中的 file_storage_path 属性设置为所需的路径。
$ msg-store-http-server --file-storage --file-storage-path=/path/to/file/storage/dir
此路径也应为目录。
主机 & 端口
使用各自的标志设置主机和端口或在 config.json 文件中更改它们。
$ msg-store-http-server --host=my.host.com --port=3300
默认值为 127.0.0.1 和 8080
存储 & 组默认值
存储和优先级组的默认值可以动态更改,并将在 config.json 中反映出来(如果服务器设置为使用其中一个)。如果服务器不应反映这些更改,请传递 --no-update 标志或在 config.json 中将 no_update 属性设置为 false。请注意,--update 和 --no-update 是互斥选项,应用程序将拒绝设置。
最大字节数
存储或任何优先级组的最大字节数不能通过标志传递,但可以在config.json文件或通过http api进行配置。
可用客户端
依赖项
~26–39MB
~670K SLoC