Skip to main content
Committed ⭐️⭐️⭐️
Mar 27, 2025 5:13 PM UTC
Solved

local file extractor configuration yaml environment variable setup

I am new bee for this mammal, to Setup the Cognite file extractor for the local file upload to CDF, how to I config the environment variable in the yaml?
according to the example-local.yaml I need to read:
COGNITE_BASE_URL
COGNITE_PROJECT
COGNITE_CLIENT_ID
COGNITE_TOKEN_URL
COGNITE_CLIENT_SECRET

I am little confuse, should I create a .env file to have all of those environment variables in that file and put it in the same folder as the yaml config file or can I inject those variables in the configuration file itself, if so any example?  need someone lighting me up.

Lead Product Manager
Mar 31, 2025 1:36 PM UTC

Yes, the file extractor supports reading an .env file stored in the local directory for the file extractor binary.

4 replies

Mithila Jayalath
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Mar 31, 2025 8:59 AM UTC

Hope this documentation here will help you. 

Lead Product Manager
Mar 31, 2025 9:14 AM UTC

In short:

You have to specify the environment variables in the config.yaml file.

 

cognite:

   secret: ${CLIENT_SECRET}

 

Then you need some way to populate the environment variable with the correct value. 

Some (most) of the extractors support adding an .env file in the same directory as where you’re running the extractor binary from. Other approaches depend on how (and on what platform) you start/run the extractor. 

IIRC, we recently updated the extractors to prevent traversal searches for .env files, so the location of the .env file will matter :)

Committed ⭐️⭐️⭐️
Mar 31, 2025 12:06 PM UTC

In short:

You have to specify the environment variables in the config.yaml file.

 

cognite:

   secret: ${CLIENT_SECRET}

 

Then you need some way to populate the environment variable with the correct value. 

Some (most) of the extractors support adding an .env file in the same directory as where you’re running the extractor binary from. Other approaches depend on how (and on what platform) you start/run the extractor. 

IIRC, we recently updated the extractors to prevent traversal searches for .env files, so the location of the .env file will matter :)

Thank you for the clarification, so in general, does the Local file extractor support the .env? of course I put the .env file in the same directory as the yaml configuration file.

Lead Product Manager
Mar 31, 2025 1:36 PM UTC

Yes, the file extractor supports reading an .env file stored in the local directory for the file extractor binary.