Using dotenv connector with own .env file in TYPO3 extensionUnable to include a php file in typo3composer installs own TYPO3 extension in wrong pathTemplavoila extension supports TYPO3 CMS 7.6.4 LTSHow can I add a composer.json to a static TYPO3 project?dotenv-connector within TYPO3 CMSTYPO3 extension autoloader not loading librariesTYPO3-Console with composer -> propagate changes to extensionsFunctional tests not working with TYPO3 9.2 (composer mode)process.env shows all the relevant key-value pairs, but tyring to access the ones I added in .env files returns undefinedTYPO3 8.7 – /fileadmin/_processed_/ Files not found after some time

Teaching indefinite integrals that require special-casing

Minimal reference content

How to combine multiple text files of different lengths and multiple columns by a column

What would happen if the UK refused to take part in EU Parliamentary elections?

Can I use my Chinese passport to enter China after I acquired another citizenship?

Modify casing of marked letters

Everything Bob says is false. How does he get people to trust him?

Coordinate position not precise

How will losing mobility of one hand affect my career as a programmer?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Why does John Bercow say “unlock” after reading out the results of a vote?

Tiptoe or tiphoof? Adjusting words to better fit fantasy races

What to do with wrong results in talks?

Cynical novel that describes an America ruled by the media, arms manufacturers, and ethnic figureheads

Using parameter substitution on a Bash array

The plural of 'stomach"

How do I define a right arrow with bar in LaTeX?

Was Spock the First Vulcan in Starfleet?

Curses work by shouting - How to avoid collateral damage?

Can criminal fraud exist without damages?

What is the intuitive meaning of having a linear relationship between the logs of two variables?

Have I saved too much for retirement so far?

when is out of tune ok?

Is there a problem with hiding "forgot password" until it's needed?



Using dotenv connector with own .env file in TYPO3 extension


Unable to include a php file in typo3composer installs own TYPO3 extension in wrong pathTemplavoila extension supports TYPO3 CMS 7.6.4 LTSHow can I add a composer.json to a static TYPO3 project?dotenv-connector within TYPO3 CMSTYPO3 extension autoloader not loading librariesTYPO3-Console with composer -> propagate changes to extensionsFunctional tests not working with TYPO3 9.2 (composer mode)process.env shows all the relevant key-value pairs, but tyring to access the ones I added in .env files returns undefinedTYPO3 8.7 – /fileadmin/_processed_/ Files not found after some time













0















I'm using the dotenv connector to parse .env files already in the main project directory. This works.



But I have problems to use the connector with an own .env WITHIN my own extension directory.



Extension is added to the main project by composer requirement:



"repositories": [
"type": "vcs", "url": "git@github.com:myself/myextension.git"
],
"require":
...
"myself/myextension": "dev-master"
,


Composer structure of my extension:



"require": 
"typo3/cms-core": "^9.5",
"helhum/dotenv-connector": "^2.1"
,
"config":
"vendor-dir": ".Build/vendor",
"bin-dir": ".Build/bin"
,
"extra":
"helhum/dotenv-connector":
"env-file": ".env"
,
"typo3/cms":
"cms-package-dir": "$vendor-dir/typo3/cms",
"web-dir": ".Build/Web"




.env file located in same dir as the extension composer.json:



typo3conf/ext/my_extension
-- composer.json
-- .env


Example content of .env file



T3_NEW_ENV_VAR='SUCCESSFULLY LOADED ENV VAR'


Testing by reading env var in TypoScript



page.40 = TEXT
page.40.value := getEnv(T3_NEW_ENV_VAR)


Output SHOULD: SUCCESSFULLY LOADED ENV VAR



Output IS: empty



If I move the .env file to the main project directory, same TypoScript can read the env var and outputs the correct value. Composer reads the .env in the main project directory, not in my extension directory.



Question:



Is it possible to require and use dotenv connector in own extension, independent of the main TYPO3 project?










share|improve this question




























    0















    I'm using the dotenv connector to parse .env files already in the main project directory. This works.



    But I have problems to use the connector with an own .env WITHIN my own extension directory.



    Extension is added to the main project by composer requirement:



    "repositories": [
    "type": "vcs", "url": "git@github.com:myself/myextension.git"
    ],
    "require":
    ...
    "myself/myextension": "dev-master"
    ,


    Composer structure of my extension:



    "require": 
    "typo3/cms-core": "^9.5",
    "helhum/dotenv-connector": "^2.1"
    ,
    "config":
    "vendor-dir": ".Build/vendor",
    "bin-dir": ".Build/bin"
    ,
    "extra":
    "helhum/dotenv-connector":
    "env-file": ".env"
    ,
    "typo3/cms":
    "cms-package-dir": "$vendor-dir/typo3/cms",
    "web-dir": ".Build/Web"




    .env file located in same dir as the extension composer.json:



    typo3conf/ext/my_extension
    -- composer.json
    -- .env


    Example content of .env file



    T3_NEW_ENV_VAR='SUCCESSFULLY LOADED ENV VAR'


    Testing by reading env var in TypoScript



    page.40 = TEXT
    page.40.value := getEnv(T3_NEW_ENV_VAR)


    Output SHOULD: SUCCESSFULLY LOADED ENV VAR



    Output IS: empty



    If I move the .env file to the main project directory, same TypoScript can read the env var and outputs the correct value. Composer reads the .env in the main project directory, not in my extension directory.



    Question:



    Is it possible to require and use dotenv connector in own extension, independent of the main TYPO3 project?










    share|improve this question


























      0












      0








      0








      I'm using the dotenv connector to parse .env files already in the main project directory. This works.



      But I have problems to use the connector with an own .env WITHIN my own extension directory.



      Extension is added to the main project by composer requirement:



      "repositories": [
      "type": "vcs", "url": "git@github.com:myself/myextension.git"
      ],
      "require":
      ...
      "myself/myextension": "dev-master"
      ,


      Composer structure of my extension:



      "require": 
      "typo3/cms-core": "^9.5",
      "helhum/dotenv-connector": "^2.1"
      ,
      "config":
      "vendor-dir": ".Build/vendor",
      "bin-dir": ".Build/bin"
      ,
      "extra":
      "helhum/dotenv-connector":
      "env-file": ".env"
      ,
      "typo3/cms":
      "cms-package-dir": "$vendor-dir/typo3/cms",
      "web-dir": ".Build/Web"




      .env file located in same dir as the extension composer.json:



      typo3conf/ext/my_extension
      -- composer.json
      -- .env


      Example content of .env file



      T3_NEW_ENV_VAR='SUCCESSFULLY LOADED ENV VAR'


      Testing by reading env var in TypoScript



      page.40 = TEXT
      page.40.value := getEnv(T3_NEW_ENV_VAR)


      Output SHOULD: SUCCESSFULLY LOADED ENV VAR



      Output IS: empty



      If I move the .env file to the main project directory, same TypoScript can read the env var and outputs the correct value. Composer reads the .env in the main project directory, not in my extension directory.



      Question:



      Is it possible to require and use dotenv connector in own extension, independent of the main TYPO3 project?










      share|improve this question
















      I'm using the dotenv connector to parse .env files already in the main project directory. This works.



      But I have problems to use the connector with an own .env WITHIN my own extension directory.



      Extension is added to the main project by composer requirement:



      "repositories": [
      "type": "vcs", "url": "git@github.com:myself/myextension.git"
      ],
      "require":
      ...
      "myself/myextension": "dev-master"
      ,


      Composer structure of my extension:



      "require": 
      "typo3/cms-core": "^9.5",
      "helhum/dotenv-connector": "^2.1"
      ,
      "config":
      "vendor-dir": ".Build/vendor",
      "bin-dir": ".Build/bin"
      ,
      "extra":
      "helhum/dotenv-connector":
      "env-file": ".env"
      ,
      "typo3/cms":
      "cms-package-dir": "$vendor-dir/typo3/cms",
      "web-dir": ".Build/Web"




      .env file located in same dir as the extension composer.json:



      typo3conf/ext/my_extension
      -- composer.json
      -- .env


      Example content of .env file



      T3_NEW_ENV_VAR='SUCCESSFULLY LOADED ENV VAR'


      Testing by reading env var in TypoScript



      page.40 = TEXT
      page.40.value := getEnv(T3_NEW_ENV_VAR)


      Output SHOULD: SUCCESSFULLY LOADED ENV VAR



      Output IS: empty



      If I move the .env file to the main project directory, same TypoScript can read the env var and outputs the correct value. Composer reads the .env in the main project directory, not in my extension directory.



      Question:



      Is it possible to require and use dotenv connector in own extension, independent of the main TYPO3 project?







      typo3 dotenv






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 11:44







      Mikel Wohlschlegel

















      asked Mar 7 at 11:38









      Mikel WohlschlegelMikel Wohlschlegel

      356311




      356311






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55042905%2fusing-dotenv-connector-with-own-env-file-in-typo3-extension%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55042905%2fusing-dotenv-connector-with-own-env-file-in-typo3-extension%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown