JussiMannisto

Experience

130

0 Best Reply Awards

  • Member Since 1 Week Ago
  • 0 Lessons Completed
  • 0 Favorites

6th December, 2017

JussiMannisto left a reply on Proper Place For Adding Language Namespaces • 6 days ago

Thanks Martin!

That's pretty much what I've done, except the package doesn't have its own service provider. I'll definitely be adding that.

JussiMannisto started a new conversation Proper Place For Adding Language Namespaces • 6 days ago

Hi,

I'm developing a dual-site which consists of an API served by a Lumen instance, and a CMS site built with Laravel (both ver. 5.5). These sites share a database and some resources, such as translations.

I'm using language namespaces to access the shared translations, like so:

Lang::addNamespace('someNamespace', realpath(base_path('../shared/resources/lang')));

I'm wondering what is the correct file & place for adding the namespace? I can't load them in bootstrap/app.php since the Lang facade hasn't been set up at that point. Currently I'm doing this in a service provider and it works, but that doesn't seem to me like the "proper" place to do it.

5th December, 2017

JussiMannisto left a reply on Referencing Other Environment Variables In .env • 1 week ago

@robrogers3 That is not true.

Laravel's documentation tells that they use the DotEnv PHP library for environment configuration. From its source code I found out that it supports nested variables, which is exactly what I needed. See the function Dotenv\Loader->resolveNestedVariables for reference.

Here's an example for anyone looking for a solution:

INDEX_NAME=dev_index
UPDATE_INDEXER_COMMAND="/some-path/indexer.sh ${INDEX_NAME} --update"
LIVE_INDEXER_COMMAND="/some-path/indexer.sh ${INDEX_NAME} --live"

4th December, 2017

JussiMannisto left a reply on Referencing Other Environment Variables In .env • 1 week ago

My only goal is to reduce repetition in the .env file. The index name is environment specific, and it is repeated many times in the environment variables.

Of course I can write it out manually on each row, or use a placeholder and insert it in code. But if there's a way of injecting INDEX_NAME to other variables, that would be more elegant.

JussiMannisto started a new conversation Referencing Other Environment Variables In .env • 1 week ago

Hi,

When defining environment variables in the .env file, is there a way of referencing a variable that was defined earlier? I'd like to do something like this:

INDEX_NAME=dev_index UPDATE_INDEXER_COMMAND="/some-path/indexer.sh $INDEX_NAME --update" LIVE_INDEXER_COMMAND="/some-path/indexer.sh $INDEX_NAME --live" ...

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.