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:
services:
envs:
- key: MY_FIRST_VAR
scope: BUILD_AND_RUN_TIME
value: a_key_value
- key: A_UNIQUE_KEY
scope: BUILD_AND_RUN_TIME
value: 123456789asdf
packages:
- name: sample
actions:
- 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!
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!
Hi there,
You should be able to define environment variables as follows:
packages:
- name: sample
environment:
DATABASE_URL: "${DATABASE_URL}"
actions:
- name: hello
runtime: 'python:default'
Here are some more examples as well:
https://docs.digitalocean.com/products/functions/reference/project-configuration/#examples
Let me know how it goes!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.