Giter Site home page Giter Site logo

Comments (2)

bvanelli avatar bvanelli commented on June 11, 2024

This issue seems to be related first to the FULL_URL containing extra parenthesis, and second, the AWS_URL variable is being replaced by itself on the .env. The first is easy to solve, replacing:

FULL_URL="$({AWS_URL})/some-bucket"

with:

FULL_URL="${AWS_URL}/some-bucket"

I'm not sure if the variable expansion is handled with parenthesis, because evaluating what is inside first could have multiple meanings in python. The second is harder to handle though. I'd advice never overwriting the variables with itself:

AWS_URL=${AWS_URL:-http://localhost:9000/s3}

This is basically a recursive replacement, this is actually handled by python-dotenv, not environs, somehow it selects the default value when it finds a recursive replacement (I tried looking at their implementation but didn't find how they handle this case). For me, this .env works as expected:

AWS_URL_PREFIX=http://s3service:9000/s3
AWS_URL=${AWS_URL_PREFIX:-http://localhost:9000/s3}
FULL_URL="${AWS_URL}/some-bucket"
from environs import Env

env = Env(expand_vars=True)
env.read_env()
print(env.str("AWS_URL"))
print(env.str("FULL_URL"))

Gives me:

http://s3service:9000/s3
http://s3service:9000/s3/some-bucket

Process finished with exit code 0

from environs.

Related Issues (20)

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.