Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
77a89e98aa | |||
27a94db3c7 | |||
fa6dd55ba0 | |||
2dda8ebd76 | |||
789e702e7d | |||
f9184379b2 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
.DS_Store
|
||||
.terraform
|
||||
node_modules
|
||||
/api/deploy
|
||||
/web/dist
|
||||
/dist
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
FROM 063932952339.dkr.ecr.us-west-2.amazonaws.com/alpine-nim:nim-1.6.10 AS build
|
||||
MAINTAINER jonathan@jdbernard.com
|
||||
|
||||
COPY hff_entry_forms_api.nimble /hff_entry_forms_api/
|
||||
COPY src /hff_entry_forms_api/src
|
||||
|
16
api/Makefile
16
api/Makefile
@ -13,6 +13,8 @@ endif
|
||||
# The server to target when publishing the API
|
||||
TARGET_SERVER ?= sobeck.jdb-software.com
|
||||
|
||||
TARGET_ENV ?= local
|
||||
|
||||
# The Notion integration token.
|
||||
AUTH_SECRET ?= 123abc
|
||||
|
||||
@ -90,19 +92,19 @@ echo-vars:
|
||||
"PORT=$(PORT)\n" \
|
||||
"INTEGRATION_TOKEN=$(INTEGRATION_TOKEN)\n"
|
||||
|
||||
publis:
|
||||
publish:
|
||||
-rm -r deploy
|
||||
-mkdir deploy
|
||||
m4 \
|
||||
-D "HFF_ENTRY_FORMS_API_VERSION=$(VERSION)" \
|
||||
-D "TARGET_ENV=$(TARGET_ENV)" \
|
||||
-D "TARGET_PORT=$(TARGET_PORT)" \
|
||||
-D "TARGET_PORT=$(PORT)" \
|
||||
hff_entry_forms_api.service \
|
||||
> deploy/hff_entry_forms_api.$(TARGET_ENV).service
|
||||
-ssh deployer@$(TARGET_SERVER) "docker stop hff_entry_forms.$(TARGET_ENV).service && sudo systemctl stop hff_entry_forms.$(TARGET_ENV)"
|
||||
ssh deployer@$(TARGET_SERVER) "aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin $(ECR_ACCOUNT_URL) && docker pull $(ECR_ACCOUNT_URL)/hff_entry_forms:$(VERSION)"
|
||||
-ssh deployer@$(TARGET_SERVER) "docker stop hff_entry_forms_api.$(TARGET_ENV).service && sudo systemctl stop hff_entry_forms_api.$(TARGET_ENV)"
|
||||
ssh deployer@$(TARGET_SERVER) "aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin $(ECR_ACCOUNT_URL) && docker pull $(ECR_ACCOUNT_URL)/hff_entry_forms_api:$(VERSION)"
|
||||
scp \
|
||||
deploy/hff_entry_forms.$(TARGET_ENV).service \
|
||||
deployer@$(TARGET_SERVER):/etc/systemd/system/hff_entry_forms.$(TARGET_ENV).service
|
||||
deploy/hff_entry_forms_api.$(TARGET_ENV).service \
|
||||
deployer@$(TARGET_SERVER):/etc/systemd/system/hff_entry_forms_api.$(TARGET_ENV).service
|
||||
ssh deployer@$(TARGET_SERVER) "sudo systemctl daemon-reload"
|
||||
ssh deployer@$(TARGET_SERVER) "sudo systemctl start hff_entry_forms.$(TARGET_ENV)"
|
||||
ssh deployer@$(TARGET_SERVER) "sudo systemctl start hff_entry_forms_api.$(TARGET_ENV)"
|
||||
|
@ -9,7 +9,7 @@ Restart=always
|
||||
ExecStartPre=-/usr/bin/docker rm %n
|
||||
ExecStart=/usr/bin/docker run --rm -p TARGET_PORT:80 --name %n \
|
||||
--env-file /etc/hff_entry_forms/TARGET_ENV.env \
|
||||
063932952339.dkr.ecr.us-west-2.amazonaws.com/hff_entry_forms:HFF_ENTRY_FORMS_VERSION
|
||||
063932952339.dkr.ecr.us-west-2.amazonaws.com/hff_entry_forms_api:HFF_ENTRY_FORMS_API_VERSION
|
||||
ExecStop=/usr/bin/docker stop --name %n
|
||||
|
||||
[Install]
|
@ -1,4 +1,5 @@
|
||||
import cliutils, docopt, json, logging, sequtils, strutils, tables
|
||||
import std/[json, logging, os, sequtils, strutils, tables]
|
||||
import cliutils, docopt
|
||||
|
||||
import hff_entry_forms_apipkg/api
|
||||
import hff_entry_forms_apipkg/version
|
||||
@ -26,12 +27,13 @@ proc loadConfig(args: Table[string, docopt.Value]): HffEntryFormsApiConfig =
|
||||
let cfg = CombinedConfig(docopt: args, json: json)
|
||||
|
||||
result = HffEntryFormsApiConfig(
|
||||
debug: args["--debug"],
|
||||
debug: cfg.hasKey("debug") and cfg.getVal("debug") == "true",
|
||||
eventParentId: cfg.getVal("event-parent-id"),
|
||||
integrationToken: cfg.getVal("integration-token"),
|
||||
knownOrigins: cfg.getVal("known-origins")[1..^2].split(',').mapIt(it[1..^2]),
|
||||
notionApiBaseUrl: cfg.getVal("notion-api-base-url"),
|
||||
notionVersion: cfg.getVal("notion-version"),
|
||||
notionConfigDbId: cfg.getVal("notion-config-db-id"),
|
||||
port: parseInt(cfg.getVal("port", "8300")))
|
||||
|
||||
when isMainModule:
|
||||
@ -59,11 +61,11 @@ Options:
|
||||
# Initialize our service context
|
||||
let args = docopt(doc, version = HFF_ENTRY_FORMS_API_VERSION)
|
||||
|
||||
if args["--debug"]:
|
||||
consoleLogger.levelThreshold = lvlDebug
|
||||
|
||||
let cfg = loadConfig(args)
|
||||
|
||||
if cfg.debug:
|
||||
consoleLogger.levelThreshold = lvlDebug
|
||||
|
||||
if args["serve"]: start(cfg)
|
||||
|
||||
except:
|
||||
|
@ -11,7 +11,7 @@ proc getNotionClient(cfg: HffEntryFormsApiConfig): NotionClient =
|
||||
notionClient = some(initNotionClient(NotionClientConfig(
|
||||
apiVersion: cfg.notionVersion,
|
||||
apiBaseUrl: cfg.notionApiBaseUrl,
|
||||
configDbId: "",
|
||||
configDbId: cfg.notionConfigDbId,
|
||||
integrationToken: cfg.integrationToken)))
|
||||
return notionClient.get
|
||||
|
||||
|
@ -12,6 +12,7 @@ type
|
||||
knownOrigins*: seq[string]
|
||||
notionApiBaseUrl*: string
|
||||
notionVersion*: string
|
||||
notionConfigDbId*: string
|
||||
port*: int
|
||||
|
||||
proc newApiError*(parent: ref Exception = nil, respCode: HttpCode, respMsg: string, msg = ""): ref ApiError =
|
||||
|
13737
web/package-lock.json
generated
13737
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
import { defineComponent, Ref, ref } from 'vue';
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { logService } from '@jdbernard/logging';
|
||||
import {
|
||||
default as api,
|
||||
@ -28,8 +28,8 @@ export default defineComponent({
|
||||
props: {},
|
||||
components: { CircleCheckIcon, CircleCrossIcon, HourGlassIcon, SpinnerIcon },
|
||||
setup: function TheProposeEventView() {
|
||||
const departments: Ref<{ value: string; color: string }[]> = ref([]);
|
||||
const formState: Ref<FormState> = ref('loading');
|
||||
const departments = ref<{ value: string; color: string }[]>([]);
|
||||
const formState = ref<FormState>('loading');
|
||||
|
||||
setTimeout(async () => {
|
||||
departments.value = (await api.getEventProposalConfig()).departments;
|
||||
@ -62,14 +62,14 @@ export default defineComponent({
|
||||
if (await api.proposeEvent(formVal.event)) {
|
||||
formState.value = 'success';
|
||||
successes.push(
|
||||
`We've recorded the proposed details for ${formVal.event.name}.`
|
||||
`We've recorded the proposed details for ${formVal.event.name}.`,
|
||||
);
|
||||
} else {
|
||||
formState.value = 'error';
|
||||
errors.push(
|
||||
'We were unable to record the proposed details for ' +
|
||||
formVal.event.name +
|
||||
". Poke Jonathan and tell him it's broken."
|
||||
". Poke Jonathan and tell him it's broken.",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,11 @@
|
||||
</label>
|
||||
<label>
|
||||
<span>Date and time</span>
|
||||
<input type="date" name="date" v-model="formVal.event.date" />
|
||||
<input
|
||||
type="datetime-local"
|
||||
name="date"
|
||||
v-model="formVal.event.date"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>Department / Event Type</span>
|
||||
|
Reference in New Issue
Block a user