How to specify environment variables in the project.yml file for App Functions?

I am trying to specify two environment variables that are needed to perform some functionality on my application. I try to specify them as follows:

    - key: MY_FIRST_VAR
      scope: BUILD_AND_RUN_TIME
      value: a_key_value
    - key: A_UNIQUE_KEY
      scope: BUILD_AND_RUN_TIME
      value: 123456789asdf

  - name: sample
      - name: hello
        runtime: 'python:default'

I tried to mimic what I saw here

When I try to build, though, I get a message:

›   Error:   : Invalid project configuration file (project.yml): Invalid key 
›   'services' found in project.yml

I have tried mixing things around and trying different combinations, however I’m stuck as to how to go about this. I tried defining the environment variables through the GUI, however they were not recognized by my python program that needed them.

If you need any other information for about this to help let me know!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 4, 2023

Hi there,

You should be able to define environment variables as follows:

  - name: sample
      - name: hello
        runtime: 'python:default'

Here are some more examples as well:

Let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up