thoth-station / storages

Storage and database adapters for project Thoth
https://thoth-station.github.io/
GNU General Public License v3.0
14 stars 16 forks source link

Env var documentation mismatch #2715

Open VannTen opened 1 year ago

VannTen commented 1 year ago

The documentation does not match the code:

README.rst:


...
1. Configure environment variables

   .. list-table::
      :widths: 25 25
      :header-rows: 1

      * - Variable name
        - Content
      * - ``S3_ENDPOINT_URL``
        - Ceph Host name
      * - ``CEPH_BUCKET``
        - Ceph Bucket name
      * - ``CEPH_BUCKET_PREFIX``
        - Ceph Prefix
      * - ``CEPH_KEY_ID``
        - Ceph Key ID
      * - ``CEPH_SECRET_KEY``
        - Ceph Secret Key

   .. code-block:: python

       from thoth.storages.ceph import CephStore
       ceph = CephStore()

thoth/storages/ceph.py:


class CephStore(StorageBase):
    """Adapter for storing and retrieving data from Ceph - low level API."""

    def __init__(
        self,
        prefix,
        *,
        host: str = None,
        key_id: str = None,
        secret_key: str = None,
        bucket: str = None,
        region: str = None,
    ):
        """Initialize adapter to Ceph.

        Parameters not explicitly provided will be picked from env variables.
        """
        super().__init__()
        self.host = host or os.environ["THOTH_S3_ENDPOINT_URL"]
        self.key_id = key_id or os.environ["THOTH_CEPH_KEY_ID"]
        self.secret_key = secret_key or os.environ["THOTH_CEPH_SECRET_KEY"]
        self.bucket = bucket or os.environ["THOTH_CEPH_BUCKET"]
        self.region = region or os.getenv("THOTH_CEPH_REGION", None)
        self._s3 = None
        self.prefix = prefix

/kind documentation /sig stack-guidance /priority backlog /good-first-issue

We should decide if we keep the THOTH_ env prefix or not, and adjust accordingly. Opinions ?

sesheta commented 1 year ago

@VannTen: This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to [this](https://github.com/thoth-station/storages/issues/2715): >The documentation does not match the code: > >README.rst: >```rst > >... >1. Configure environment variables > > .. list-table:: > :widths: 25 25 > :header-rows: 1 > > * - Variable name > - Content > * - ``S3_ENDPOINT_URL`` > - Ceph Host name > * - ``CEPH_BUCKET`` > - Ceph Bucket name > * - ``CEPH_BUCKET_PREFIX`` > - Ceph Prefix > * - ``CEPH_KEY_ID`` > - Ceph Key ID > * - ``CEPH_SECRET_KEY`` > - Ceph Secret Key > > .. code-block:: python > > from thoth.storages.ceph import CephStore > ceph = CephStore() >``` > >thoth/storages/ceph.py: >```python > >class CephStore(StorageBase): > """Adapter for storing and retrieving data from Ceph - low level API.""" > > def __init__( > self, > prefix, > *, > host: str = None, > key_id: str = None, > secret_key: str = None, > bucket: str = None, > region: str = None, > ): > """Initialize adapter to Ceph. > > Parameters not explicitly provided will be picked from env variables. > """ > super().__init__() > self.host = host or os.environ["THOTH_S3_ENDPOINT_URL"] > self.key_id = key_id or os.environ["THOTH_CEPH_KEY_ID"] > self.secret_key = secret_key or os.environ["THOTH_CEPH_SECRET_KEY"] > self.bucket = bucket or os.environ["THOTH_CEPH_BUCKET"] > self.region = region or os.getenv("THOTH_CEPH_REGION", None) > self._s3 = None > self.prefix = prefix >``` > >/kind documentation >/sig stack-guidance >/priority backlog >/good-first-issue > > >We should decide if we keep the `THOTH_` env prefix or not, and adjust >accordingly. Opinions ? > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.