You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run this in a docker container using OpenMeteo as my provider. I have the following in my .env file when I build the docker container:
HOST=0.0.0.0
PORT=3000
WEATHER_PROVIDER=OpenMeteo
However when I run the docker image I get the following error:
> os-weather-service@2.1.0 start
> node js/server
/weather/js/routes/weatherProviders/Apple.js:62
throw "APPLE_PRIVATE_KEY environment variable is not defined.";
^
APPLE_PRIVATE_KEY environment variable is not defined.
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v19.8.1
I have tried changing WEATHER_PROVIDER to PWS_WEATHER_PROVIDER with the same result.
Looking at weather.ts I can see that it is trying to get the provider from the request rather than the environment variable, and since there isn't any provider specified, it defaults to Apple as the provider.
How is this supposed to work - the documentation doesn't seem up to date.
The text was updated successfully, but these errors were encountered:
MattyRoy
changed the title
Setting WEATHER_PROVIDER in the .env file doesn't work
Setting WEATHER_PROVIDER in the .env file doesn't work for master
Feb 19, 2025
Looking at the code and debugging it, the Apple weather provider constructor requires APPLE_PRIVATE_KEY to be set. This doesn't seem correct if one is not going to use Apple as your weather provider?
I see. This is because on our own weather server we use Apple as default and provide our own key. We will take a look at removing this requirement -- it's not as simple as the other providers as Apple requires more key data than just a string key. With other providers, you can pass in the API key through the wto option, that way the provider and key can both be provided through the url. With Apple this is a bit more complicated.
In the meantime, the workaround is to simply delete line 17 and below in Apple.ts (in the constructor function). That should allow you to launch the service.
Thanks for the reply @rayshobby. Yes, I removed Apple as a provider entirely from my local weather.ts file before building the docker image - this works as an interim solution.
I am trying to run this in a docker container using OpenMeteo as my provider. I have the following in my .env file when I build the docker container:
However when I run the docker image I get the following error:
I have tried changing
WEATHER_PROVIDER
toPWS_WEATHER_PROVIDER
with the same result.Looking at
weather.ts
I can see that it is trying to get the provider from the request rather than the environment variable, and since there isn't any provider specified, it defaults to Apple as the provider.How is this supposed to work - the documentation doesn't seem up to date.
The text was updated successfully, but these errors were encountered: