Ejemplo n.º 1
0
 def _create_minio_client(self):
       # Adding prefixing "http" in urlparse is necessary for it to be the netloc
       url = urlparse(os.getenv("AWS_ENDPOINT_URL", "http://s3.amazonaws.com"))
       use_ssl = (
           url.scheme == "https"
           if url.scheme
           else bool(getenv("USE_SSL", "S3_USE_HTTPS", "false"))
       )
       return Minio(
           url.netloc,
           access_key=os.getenv("AWS_ACCESS_KEY_ID", ""),
           secret_key=os.getenv("AWS_SECRET_ACCESS_KEY", ""),
           region=os.getenv("AWS_REGION", ""),
           secure=use_ssl,
       )
Ejemplo n.º 2
0
 def _create_minio_client():
     # Remove possible http scheme for Minio
     url = urlparse(os.getenv("AWS_ENDPOINT_URL", "s3.amazonaws.com"))
     use_ssl = (
         url.scheme == "https" if url.scheme
         # KFServing uses S3_USE_HTTPS, whereas Seldon was already using
         # USE_SSL.
         # To keep compatibility with the storage init layer we support
         # both, giving priority to USE_SSL.
         # https://github.com/SeldonIO/seldon-core/pull/827
         # https://github.com/kubeflow/kfserving/pull/362
         else bool(getenv("USE_SSL", "S3_USE_HTTPS", "false")))
     return Minio(
         url.netloc,
         access_key=os.getenv("AWS_ACCESS_KEY_ID", ""),
         secret_key=os.getenv("AWS_SECRET_ACCESS_KEY", ""),
         secure=use_ssl,
     )
Ejemplo n.º 3
0
def test_getenv(monkeypatch, env, expected):
    for env_var, env_value in env.items():
        monkeypatch.setenv(env_var, env_value)

    value = scu.getenv("FOO1", "FOO2", "FOO3", default="DEF")
    assert value == expected