-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a411763
commit 34517c6
Showing
9 changed files
with
352 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM denoland/deno | ||
|
||
EXPOSE 8000 | ||
|
||
WORKDIR /app | ||
|
||
# prefer not to run as root | ||
USER deno | ||
|
||
# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified). | ||
# Ideally cache deps.ts will download and compile _all_ external files used in main.ts. | ||
COPY . /app | ||
RUN deno cache main.ts | ||
|
||
CMD ["run", "--allow-net", "--allow-env", "--allow-read", "--unstable-kv", "main.ts"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { load } from "std/dotenv/mod.ts"; | ||
const env = await load(); | ||
|
||
const USER_NAME = getEnv("USER_NAME"); | ||
const PASSWORD = getEnv("PASSWORD"); | ||
|
||
Deno.env.set("DENO_KV_ACCESS_TOKEN", getEnv("DENO_KV_ACCESS_TOKEN")); | ||
const KV_PATH = _undefinedEnv("KV_PATH"); | ||
|
||
const ROOM_KEY = "room"; | ||
const ROOM_CLIMATE_KEY = "room_climate"; | ||
const ROOM_BY_ID_KEY = "room_by_id"; | ||
|
||
function getEnv(key: string): string { | ||
const result = env[key] || Deno.env.get(key); | ||
if (!result) { | ||
throw new Error( | ||
`Missing env var ${key}, make sure you have a .env file or you pass it in via the command line`, | ||
); | ||
} | ||
return result; | ||
} | ||
|
||
function _undefinedEnv(key: string): string | undefined { | ||
return env[key] || Deno.env.get(key); | ||
} | ||
|
||
export { | ||
KV_PATH, | ||
PASSWORD, | ||
ROOM_BY_ID_KEY, | ||
ROOM_CLIMATE_KEY, | ||
ROOM_KEY, | ||
USER_NAME, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3' | ||
|
||
services: | ||
web: | ||
build: . | ||
container_name: deno-container | ||
environment: | ||
- USER_NAME=<USER_NAME> | ||
- PASSWORD=<PASSWORD> | ||
- DENO_KV_ACCESS_TOKEN=<DENO_KV_ACCESS_TOKEN> | ||
- KV_PATH=<KV_PATH> | ||
ports: | ||
- "8000:8000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.