Giter Club home page Giter Club logo

config-reader-python's People

Contributors

chadwcarlson avatar crell avatar danmilon avatar nickanderegg avatar otaviojava avatar ovv avatar ralt avatar yhoiseth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

config-reader-python's Issues

Possible backwards-incompatible change between 2.1.1 and 2.2.3

Today, I upgraded from version 2.1.1 to version 2.2.3. The following code started throwing an exception on our queue worker:

    def allowed_hosts(self) -> List[str]:
        allowed_hosts: List[str] = ["localhost", "127.0.0.1", "[::1]"]
        if self.is_valid_platform() and self.in_runtime():
            try:
                for url, route in self.routes().items():
                    host: str = urlparse(url).netloc
                    if (
                        host not in allowed_hosts
                        and route["type"] == "upstream"
                        and route["upstream"] == self.applicationName
                    ):
                        allowed_hosts.append(host)
            except AttributeError:
                """
                The Huey worker doesn't have access to routes.
                """
                pass
        return allowed_hosts

The following exception was raised:

platformshconfig.config.NotValidPlatformException: No routes are defined.  Are you sure you are running on Platform.sh?

By replacing AttributeError with NotValidPlatformException (and adding the required import statement), the problem was resolved.

This caused our transactional emails to not be taken out of the queue while I fixed the issue. Not a huge issue this time because I tested manually and discovered the problem quickly, but not ideal either.

Update the process used by on_production() to determine whether or not the current branch is production

In L421 of config.py the prod_branch variable is set based on whether or not the environment is called master.

Since Platform.sh now allows for renaming the default / production branch, this no longer produces an accurate value because it can be called anything (defaulting to main).

A more accurate way of determining whether or not the current branch is a production branch is to query the PLATFORM_ENVIRONMENT_TYPE environmental variable, which will return the correct environment type regardless of its name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.