diff --git a/README.md b/README.md
index 02a75ac..1486fbc 100644
--- a/README.md
+++ b/README.md
@@ -27,8 +27,15 @@ way of handling the configuration and initialization.
-Additionally, custom source _(to download binaries)_ can be configured by specifying the environment variables,
-`GIT_OWNER` and `GIT_REPO`
+Additionally, custom source _(to download binaries)_ can be configured by specifying the following environment variables
+
+- **OWNER** - Owner of the GitHub repo.
+- **REPO** - Repository name.
+- **TOKEN** - GitHub repository token.
+- **VERSION** - Version of the release.
+
+> _also supports the dotenv file `.github.env`, and prefixes like `github`, `git` and `filebrowser`_
+
For this custom source feature to work, the executable should be uploaded to releases as assets,
and follow the naming convention below.
@@ -43,7 +50,7 @@ and follow the naming convention below.
python -m pip install pyfilebrowser
```
-**Initiate**
+**Initiate [programmatically]**
```python
import pyfilebrowser
@@ -53,6 +60,11 @@ if __name__ == '__main__':
browser.start()
```
+**Initiate [CLI]**
+```shell
+pyfilebrowser
+```
+
## Environment Variables
Env vars can either be loaded from `.env` files or directly passed during object init.
@@ -68,10 +80,11 @@ Env vars can either be loaded from `.env` files or directly passed during object
- **workers** `int` - Number of workers used to run the proxy server. _Defaults to `1`_
- **debug** `bool` - Boolean flag to enable debug level logging. _Defaults to `False`_
- **origins** `List[str]` - Origins to allow connections through proxy server. _Defaults to `host`_
-- **public_ip** `bool` - Boolean flag to allow public IP address of the host. _Defaults to `False`_
-- **private_ip** `bool` - Boolean flag to allow private IP address of the host. _Defaults to `False`_
+- **allow_public_ip** `bool` - Boolean flag to allow public IP address of the host. _Defaults to `False`_
+- **allow_private_ip** `bool` - Boolean flag to allow private IP address of the host. _Defaults to `False`_
- **origin_refresh** `int` - Interval in seconds to refresh all the allowed origins. _Defaults to `None`_
- **error_page** `FilePath` - Error page to serve when filebrowser API is down. _Defaults to_ [error.html]
+- **warn_page** `FilePath` - Warning page to serve when accessed from Unsupported browsers. _Defaults to_ [warn.html]
- **rate_limit** - `Dict/List[Dict]` with the rate limit for the proxy server. _Defaults to `None`_
> `origin_refresh` allows users to set a custom interval to update the public and private IP address of the host,
@@ -216,6 +229,7 @@ Licensed under the [MIT License][license]
[pep8]: https://www.python.org/dev/peps/pep-0008/
[isort]: https://pycqa.github.io/isort/
[error.html]: https://github.com/thevickypedia/pyfilebrowser/blob/main/pyfilebrowser/proxy/error.html
+[warn.html]: https://github.com/thevickypedia/pyfilebrowser/blob/main/pyfilebrowser/proxy/warn.html
[Rate limiting]: https://www.cloudflare.com/learning/bots/what-is-rate-limiting/
[DDoS]: https://www.cloudflare.com/learning/ddos/glossary/denial-of-service/
[Rate Limiter]: https://builtin.com/software-engineering-perspectives/rate-limiter
diff --git a/doc_gen/index.rst b/doc_gen/index.rst
index 7fb0927..a42ddcd 100644
--- a/doc_gen/index.rst
+++ b/doc_gen/index.rst
@@ -174,29 +174,13 @@ Download
====
-.. autoclass:: pyfilebrowser.squire.download.ExtendedEnvSettingsSource(pydantic_settings.EnvSettingsSource)
- :exclude-members: _abc_impl, model_config, model_fields, model_computed_fields
-
-====
-
-.. autoclass:: pyfilebrowser.squire.download.ExtendedSettingsConfigDict(pydantic_settings.SettingsConfigDict)
- :exclude-members: _abc_impl, model_computed_fields, model_config, model_fields, env_prefixes, title, str_to_lower, str_to_upper, str_strip_whitespace, str_min_length, str_max_length, extra, frozen, populate_by_name, use_enum_values, validate_assignment, arbitrary_types_allowed, from_attributes, loc_by_alias, alias_generator, ignored_types, allow_inf_nan, json_schema_extra, json_encoders, strict, revalidate_instances, ser_json_timedelta, ser_json_bytes, ser_json_inf_nan, validate_default, validate_return, protected_namespaces, hide_input_in_errors, defer_build, plugin_settings, schema_generator, json_schema_serialization_defaults_required, json_schema_mode_override, coerce_numbers_to_str, regex_engine, validation_error_cause, case_sensitive, env_prefix, env_file, env_file_encoding, env_ignore_empty, env_nested_delimiter, env_parse_none_str, secrets_dir, json_file, json_file_encoding, yaml_file, yaml_file_encoding, toml_file
-
-====
-
-.. autoclass:: pyfilebrowser.squire.download.ExtendedBaseSettings(pydantic_settings.BaseSettings)
- :exclude-members: _abc_impl, model_computed_fields, model_config, model_fields, env_prefixes, title, str_to_lower, str_to_upper, str_strip_whitespace, str_min_length, str_max_length, extra, frozen, populate_by_name, use_enum_values, validate_assignment, arbitrary_types_allowed, from_attributes, loc_by_alias, alias_generator, ignored_types, allow_inf_nan, json_schema_extra, json_encoders, strict, revalidate_instances, ser_json_timedelta, ser_json_bytes, ser_json_inf_nan, validate_default, validate_return, protected_namespaces, hide_input_in_errors, defer_build, plugin_settings, schema_generator, json_schema_serialization_defaults_required, json_schema_mode_override, coerce_numbers_to_str, regex_engine, validation_error_cause, case_sensitive, env_prefix, env_file, env_file_encoding, env_ignore_empty, env_nested_delimiter, env_parse_none_str, secrets_dir, json_file, json_file_encoding, yaml_file, yaml_file_encoding, toml_file
- :noindex:
-
-====
-
-.. autoclass:: pyfilebrowser.squire.download.GitHub(ExtendedBaseSettings)
+.. autoclass:: pyfilebrowser.squire.download.GitHub(pydantic.BaseSettings)
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields
====
.. automodule:: pyfilebrowser.squire.download
- :exclude-members: ExtendedEnvSettingsSource, ExtendedSettingsConfigDict, ExtendedBaseSettings, GitHub, Executable
+ :exclude-members: GitHub, Executable
Steward
=======
diff --git a/docs/README.html b/docs/README.html
index 8618a1a..d9581d5 100644
--- a/docs/README.html
+++ b/docs/README.html
@@ -62,9 +62,17 @@
pyfilebrowser
automatically downloads the system specific executable during startup.
Additionally, custom source (to download binaries) can be configured by specifying the environment variables,
-GIT_OWNER
and GIT_REPO
-For this custom source feature to work, the executable should be uploaded to releases as assets,
+
Additionally, custom source (to download binaries) can be configured by specifying the following environment variables
+OWNER - Owner of the GitHub repo.
REPO - Repository name.
TOKEN - GitHub repository token.
VERSION - Version of the release.
++also supports the dotenv file
+.github.env
, and prefixes likegithub
,git
andfilebrowser
For this custom source feature to work, the executable should be uploaded to releases as assets, and follow the naming convention below.
-asset naming convention:
${operating system}-{architecture}-filebrowser-{extension}
@@ -76,7 +84,7 @@Kick Off
python -m pip install pyfilebrowserInitiate
+Initiate [programmatically]
+import pyfilebrowser if __name__ == '__main__': @@ -85,6 +93,10 @@Kick Offbrowser.start()
Initiate [CLI]
++pyfilebrowser +Environment Variables¶
@@ -101,10 +113,11 @@
.env
workers
int
- Number of workers used to run the proxy server. Defaults to1
debug
bool
- Boolean flag to enable debug level logging. Defaults toFalse
- origins
List[str]
- Origins to allow connections through proxy server. Defaults tohost
- public_ip
bool
- Boolean flag to allow public IP address of the host. Defaults toFalse
+ private_ip
bool
- Boolean flag to allow private IP address of the host. Defaults toFalse
+ allow_public_ip
bool
- Boolean flag to allow public IP address of the host. Defaults toFalse
allow_private_ip
bool
- Boolean flag to allow private IP address of the host. Defaults toFalse
origin_refresh
int
- Interval in seconds to refresh all the allowed origins. Defaults toNone
+ error_page
FilePath
- Error page to serve when filebrowser API is down. Defaults to error.htmlwarn_page
FilePath
- Warning page to serve when accessed from Unsupported browsers. Defaults to warn.htmlrate_limit -
Dict/List[Dict]
with the rate limit for the proxy server. Defaults toNone
diff --git a/docs/README.md b/docs/README.md index 02a75ac..1486fbc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -27,8 +27,15 @@ way of handling the configuration and initialization.Download custom-built executables
-Additionally, custom source _(to download binaries)_ can be configured by specifying the environment variables, -`GIT_OWNER` and `GIT_REPO`
+Additionally, custom source _(to download binaries)_ can be configured by specifying the following environment variables + +- **OWNER** - Owner of the GitHub repo. +- **REPO** - Repository name. +- **TOKEN** - GitHub repository token. +- **VERSION** - Version of the release. + +> _also supports the dotenv file `.github.env`, and prefixes like `github`, `git` and `filebrowser`_ + For this custom source feature to work, the executable should be uploaded to releases as assets, and follow the naming convention below. @@ -43,7 +50,7 @@ and follow the naming convention below. python -m pip install pyfilebrowser ``` -**Initiate** +**Initiate [programmatically]** ```python import pyfilebrowser @@ -53,6 +60,11 @@ if __name__ == '__main__': browser.start() ``` +**Initiate [CLI]** +```shell +pyfilebrowser +``` + ## Environment Variables Env vars can either be loaded from `.env` files or directly passed during object init. @@ -68,10 +80,11 @@ Env vars can either be loaded from `.env` files or directly passed during object - **workers** `int` - Number of workers used to run the proxy server. _Defaults to `1`_ - **debug** `bool` - Boolean flag to enable debug level logging. _Defaults to `False`_ - **origins** `List[str]` - Origins to allow connections through proxy server. _Defaults to `host`_ -- **public_ip** `bool` - Boolean flag to allow public IP address of the host. _Defaults to `False`_ -- **private_ip** `bool` - Boolean flag to allow private IP address of the host. _Defaults to `False`_ +- **allow_public_ip** `bool` - Boolean flag to allow public IP address of the host. _Defaults to `False`_ +- **allow_private_ip** `bool` - Boolean flag to allow private IP address of the host. _Defaults to `False`_ - **origin_refresh** `int` - Interval in seconds to refresh all the allowed origins. _Defaults to `None`_ - **error_page** `FilePath` - Error page to serve when filebrowser API is down. _Defaults to_ [error.html] +- **warn_page** `FilePath` - Warning page to serve when accessed from Unsupported browsers. _Defaults to_ [warn.html] - **rate_limit** - `Dict/List[Dict]` with the rate limit for the proxy server. _Defaults to `None`_ > `origin_refresh` allows users to set a custom interval to update the public and private IP address of the host, @@ -216,6 +229,7 @@ Licensed under the [MIT License][license] [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ [error.html]: https://github.com/thevickypedia/pyfilebrowser/blob/main/pyfilebrowser/proxy/error.html +[warn.html]: https://github.com/thevickypedia/pyfilebrowser/blob/main/pyfilebrowser/proxy/warn.html [Rate limiting]: https://www.cloudflare.com/learning/bots/what-is-rate-limiting/ [DDoS]: https://www.cloudflare.com/learning/ddos/glossary/denial-of-service/ [Rate Limiter]: https://builtin.com/software-engineering-perspectives/rate-limiter diff --git a/docs/_sources/README.md.txt b/docs/_sources/README.md.txt index 02a75ac..1486fbc 100644 --- a/docs/_sources/README.md.txt +++ b/docs/_sources/README.md.txt @@ -27,8 +27,15 @@ way of handling the configuration and initialization.Download custom-built executables
-Additionally, custom source _(to download binaries)_ can be configured by specifying the environment variables, -`GIT_OWNER` and `GIT_REPO`
+Additionally, custom source _(to download binaries)_ can be configured by specifying the following environment variables + +- **OWNER** - Owner of the GitHub repo. +- **REPO** - Repository name. +- **TOKEN** - GitHub repository token. +- **VERSION** - Version of the release. + +> _also supports the dotenv file `.github.env`, and prefixes like `github`, `git` and `filebrowser`_ + For this custom source feature to work, the executable should be uploaded to releases as assets, and follow the naming convention below. @@ -43,7 +50,7 @@ and follow the naming convention below. python -m pip install pyfilebrowser ``` -**Initiate** +**Initiate [programmatically]** ```python import pyfilebrowser @@ -53,6 +60,11 @@ if __name__ == '__main__': browser.start() ``` +**Initiate [CLI]** +```shell +pyfilebrowser +``` + ## Environment Variables Env vars can either be loaded from `.env` files or directly passed during object init. @@ -68,10 +80,11 @@ Env vars can either be loaded from `.env` files or directly passed during object - **workers** `int` - Number of workers used to run the proxy server. _Defaults to `1`_ - **debug** `bool` - Boolean flag to enable debug level logging. _Defaults to `False`_ - **origins** `List[str]` - Origins to allow connections through proxy server. _Defaults to `host`_ -- **public_ip** `bool` - Boolean flag to allow public IP address of the host. _Defaults to `False`_ -- **private_ip** `bool` - Boolean flag to allow private IP address of the host. _Defaults to `False`_ +- **allow_public_ip** `bool` - Boolean flag to allow public IP address of the host. _Defaults to `False`_ +- **allow_private_ip** `bool` - Boolean flag to allow private IP address of the host. _Defaults to `False`_ - **origin_refresh** `int` - Interval in seconds to refresh all the allowed origins. _Defaults to `None`_ - **error_page** `FilePath` - Error page to serve when filebrowser API is down. _Defaults to_ [error.html] +- **warn_page** `FilePath` - Warning page to serve when accessed from Unsupported browsers. _Defaults to_ [warn.html] - **rate_limit** - `Dict/List[Dict]` with the rate limit for the proxy server. _Defaults to `None`_ > `origin_refresh` allows users to set a custom interval to update the public and private IP address of the host, @@ -216,6 +229,7 @@ Licensed under the [MIT License][license] [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ [error.html]: https://github.com/thevickypedia/pyfilebrowser/blob/main/pyfilebrowser/proxy/error.html +[warn.html]: https://github.com/thevickypedia/pyfilebrowser/blob/main/pyfilebrowser/proxy/warn.html [Rate limiting]: https://www.cloudflare.com/learning/bots/what-is-rate-limiting/ [DDoS]: https://www.cloudflare.com/learning/ddos/glossary/denial-of-service/ [Rate Limiter]: https://builtin.com/software-engineering-perspectives/rate-limiter diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index 7fb0927..a42ddcd 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -174,29 +174,13 @@ Download ==== -.. autoclass:: pyfilebrowser.squire.download.ExtendedEnvSettingsSource(pydantic_settings.EnvSettingsSource) - :exclude-members: _abc_impl, model_config, model_fields, model_computed_fields - -==== - -.. autoclass:: pyfilebrowser.squire.download.ExtendedSettingsConfigDict(pydantic_settings.SettingsConfigDict) - :exclude-members: _abc_impl, model_computed_fields, model_config, model_fields, env_prefixes, title, str_to_lower, str_to_upper, str_strip_whitespace, str_min_length, str_max_length, extra, frozen, populate_by_name, use_enum_values, validate_assignment, arbitrary_types_allowed, from_attributes, loc_by_alias, alias_generator, ignored_types, allow_inf_nan, json_schema_extra, json_encoders, strict, revalidate_instances, ser_json_timedelta, ser_json_bytes, ser_json_inf_nan, validate_default, validate_return, protected_namespaces, hide_input_in_errors, defer_build, plugin_settings, schema_generator, json_schema_serialization_defaults_required, json_schema_mode_override, coerce_numbers_to_str, regex_engine, validation_error_cause, case_sensitive, env_prefix, env_file, env_file_encoding, env_ignore_empty, env_nested_delimiter, env_parse_none_str, secrets_dir, json_file, json_file_encoding, yaml_file, yaml_file_encoding, toml_file - -==== - -.. autoclass:: pyfilebrowser.squire.download.ExtendedBaseSettings(pydantic_settings.BaseSettings) - :exclude-members: _abc_impl, model_computed_fields, model_config, model_fields, env_prefixes, title, str_to_lower, str_to_upper, str_strip_whitespace, str_min_length, str_max_length, extra, frozen, populate_by_name, use_enum_values, validate_assignment, arbitrary_types_allowed, from_attributes, loc_by_alias, alias_generator, ignored_types, allow_inf_nan, json_schema_extra, json_encoders, strict, revalidate_instances, ser_json_timedelta, ser_json_bytes, ser_json_inf_nan, validate_default, validate_return, protected_namespaces, hide_input_in_errors, defer_build, plugin_settings, schema_generator, json_schema_serialization_defaults_required, json_schema_mode_override, coerce_numbers_to_str, regex_engine, validation_error_cause, case_sensitive, env_prefix, env_file, env_file_encoding, env_ignore_empty, env_nested_delimiter, env_parse_none_str, secrets_dir, json_file, json_file_encoding, yaml_file, yaml_file_encoding, toml_file - :noindex: - -==== - -.. autoclass:: pyfilebrowser.squire.download.GitHub(ExtendedBaseSettings) +.. autoclass:: pyfilebrowser.squire.download.GitHub(pydantic.BaseSettings) :exclude-members: _abc_impl, model_config, model_fields, model_computed_fields ==== .. automodule:: pyfilebrowser.squire.download - :exclude-members: ExtendedEnvSettingsSource, ExtendedSettingsConfigDict, ExtendedBaseSettings, GitHub, Executable + :exclude-members: GitHub, Executable Steward ======= diff --git a/docs/genindex.html b/docs/genindex.html index 160ebd5..15df9f9 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -97,10 +97,16 @@A
after_upload (pyfilebrowser.modals.config.Commands attribute) -allowed_origins (pyfilebrowser.proxy.settings.Session attribute) + alias_choices() (in module pyfilebrowser.squire.download) + +allow_private_ip (pyfilebrowser.proxy.settings.EnvConfig attribute) + +allow_public_ip (pyfilebrowser.proxy.settings.EnvConfig attribute) + +
- allowed_origins (pyfilebrowser.proxy.settings.Session attribute) +
- asc (pyfilebrowser.modals.models.Sorting attribute)
- auth_config (pyfilebrowser.proxy.settings.Destination attribute) @@ -275,6 +281,8 @@
E
- (pyfilebrowser.modals.config.Tus.Config attribute)
- (pyfilebrowser.proxy.settings.EnvConfig.Config attribute) +
+- (pyfilebrowser.squire.download.GitHub.Config attribute)
env_prefix (pyfilebrowser.modals.config.Auther.Config attribute) @@ -294,17 +302,17 @@ E
(pyfilebrowser.modals.users.UserSettings.Config attribute) - -env_prefixes (pyfilebrowser.squire.download.ExtendedSettingsConfigDict attribute) + (pyfilebrowser.squire.download.GitHub.Config attribute) + +-
- EnvConfig.Config (class in pyfilebrowser.proxy.settings)
- epoch() (in module pyfilebrowser.proxy.main) @@ -316,10 +324,6 @@
E
- execute (pyfilebrowser.modals.models.Perm attribute)
- exit_process() (pyfilebrowser.main.FileBrowser method) -
-- ExtendedEnvSettingsSource (class in pyfilebrowser.squire.download) -
-- ExtendedSettingsConfigDict (class in pyfilebrowser.squire.download)
- extra (pyfilebrowser.modals.config.Auther.Config attribute) @@ -339,6 +343,8 @@
E
- (pyfilebrowser.modals.users.UserSettings.Config attribute)
- (pyfilebrowser.proxy.settings.EnvConfig.Config attribute) +
+- (pyfilebrowser.squire.download.GitHub.Config attribute)
extract() (pyfilebrowser.squire.struct.LoggerConfig method) @@ -389,9 +395,9 @@ G
@@ -547,8 +553,6 @@ O
- origins (pyfilebrowser.proxy.settings.EnvConfig attribute) -
-- origins_url_checker() (pyfilebrowser.proxy.settings.EnvConfig class method)
- owner (pyfilebrowser.squire.download.GitHub attribute)
@@ -558,6 +562,12 @@O
P