Skip to main content
Answer

local file extractor configuration yaml environment variable setup

  • March 27, 2025
  • 4 replies
  • 64 views

Forum|alt.badge.img

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.

Best answer by Thomas Sjolshagen

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

4 replies

Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

Hope this documentation here will help you. 


Forum|alt.badge.img

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 :)


Forum|alt.badge.img
  • Author
  • Committed
  • March 31, 2025

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.


Forum|alt.badge.img

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