Giter VIP home page Giter VIP logo

Comments (10)

mnapoli avatar mnapoli commented on May 30, 2024

I have found this issue that might help: https://laracasts.com/discuss/channels/servers/tinker-doset-work-in-shared-hosting

from laravel-bridge.

whobutsb avatar whobutsb commented on May 30, 2024

Thank you for the tip @mnapoli! Do you think this update to the psysh/config.php should be added as part of the BrefServiceProvider? Would you like me to write up a PR?

from laravel-bridge.

mnapoli avatar mnapoli commented on May 30, 2024

Ohh that could be interesting!

Is there any way to dynamically configure that psysh thing in the provider so that we override the config only when we are on Lambda? That way the config is not impacted when running locally. That would be awesome.

from laravel-bridge.

bobthecow avatar bobthecow commented on May 30, 2024

PsySH respects the XDG base directory specification. Can your environment define XDG_CONFIG_HOME as something that's user-writable?

from laravel-bridge.

mnapoli avatar mnapoli commented on May 30, 2024

Hi @bobthecow! Users can indeed definitely do that easily, e.g. XDG_CONFIG_HOME: /tmp/psysh in serverless.yml.

I'm wondering if there's a way to programmatically configure that in a Laravel service provider, that way things work out of the box without users having to configure anything?

from laravel-bridge.

whobutsb avatar whobutsb commented on May 30, 2024

Adding the environment variable to your serverless.yml does in fact work.
You could probably have two options:

  1. Update the bref:layer-console and include putenv("XDG_CONFIG_HOME=/tmp/psysh") in https://github.com/brefphp/bref/blob/master/runtime/layers/console/bootstrap

  2. Create a note in the laravel README to let users know to add their serverless.yml:

    artisan:
        handler: artisan
        timeout: 120 # in seconds
        environment: 
          XDG_CONFIG_HOME: /tmp/psysh
        layers:
            - ${bref:layer.php-81} # PHP
            - ${bref:layer.console} # The "console" layer

And then the syntax for running tinker commands would be:
vendor/bin/bref cli {service}-{environment}-artisan -- tinker --execute="dump(config('app'))"

from laravel-bridge.

whobutsb avatar whobutsb commented on May 30, 2024

@mnapoli Do you have an opinion on which approach you would like to take for the artisan tinker commands? I'm happy to write up a PR with your approval. Thanks!

from laravel-bridge.

buddhaCode avatar buddhaCode commented on May 30, 2024

I run into the same problem lately. I think putting it into the brefphp/bref code would be better than just documenting it to a README. But this would add some laravel specific code to the beef core. I think, that not so good.

But we can add it to the BrefApplicationProvider in this repo. I made an PR #88 for that.

from laravel-bridge.

buddhaCode avatar buddhaCode commented on May 30, 2024

Sorry. My approach with the Service Provider isn't working. The environment variable needs to be declared somewhere before in the bootstrapping process. The Service Provider seems to be loaded after the psysh thinggy.

When I was testing this, I accidently had the XDG_CONFIG_HOME left in my ´´´serverless.yaml´´´ environment section.

from laravel-bridge.

buddhaCode avatar buddhaCode commented on May 30, 2024

Awesome!

from laravel-bridge.

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.