diff --git a/.github/workflows/cd.infra.yaml b/.github/workflows/cd.infra.yaml index 8d8b0f2..3ab5462 100644 --- a/.github/workflows/cd.infra.yaml +++ b/.github/workflows/cd.infra.yaml @@ -4,7 +4,7 @@ on: push: paths: - infra/** - - .github/workflows/ci.infra.yaml + - .github/workflows/cd.infra.yaml branches: - main diff --git a/infra/app/main.tf b/infra/app/main.tf index b4135b8..cc95369 100644 --- a/infra/app/main.tf +++ b/infra/app/main.tf @@ -28,7 +28,7 @@ locals { image_base = "${var.region}-docker.pkg.dev/${var.project}/${var.project}/" client_tag = var.app_versions["client"] client_image = "${local.image_base}client:${local.client_tag}" - painter_image = "${local.image_base}painter_api:${var.app_versions["painter_api"]}" - voting_tag = var.app_versions["voting_api"] - voting_image = "${local.image_base}voting_api:${local.voting_tag}" + painter_image = "${local.image_base}painterapi:${var.app_versions["painterapi"]}" + voting_tag = var.app_versions["votingapi"] + voting_image = "${local.image_base}votingapi:${local.voting_tag}" } diff --git a/infra/app/variables.tf b/infra/app/variables.tf index c93300f..4afe7d4 100644 --- a/infra/app/variables.tf +++ b/infra/app/variables.tf @@ -2,8 +2,8 @@ variable "app_versions" { type = map(string) default = { client : "0.1.0", - voting_api : "0.1.1", - painter_api : "0.1.0", + votingapi : "0.1.1", + painterapi : "0.1.0", } } diff --git a/voting_api/Makefile b/voting_api/Makefile index dea41c8..7cbd565 100644 --- a/voting_api/Makefile +++ b/voting_api/Makefile @@ -3,9 +3,7 @@ setup: pip install --upgrade --user pipenv pipenv install --dev - -generate-openapi: - pipenv run flask --app voting.api spec + npm install -g api-spec-converter run: run-api @@ -19,7 +17,7 @@ testcase: PIPENV_DOTENV_LOCATION=.env.test pipenv run pytest ${TESTS} deploy: - gcloud run deploy --source . voting_api + gcloud run deploy --source . votingapi clean: find . -name '*~' -delete diff --git a/voting_api/Pipfile b/voting_api/Pipfile index f04219b..63dda2f 100644 --- a/voting_api/Pipfile +++ b/voting_api/Pipfile @@ -7,7 +7,6 @@ name = "pypi" flask = "*" google-cloud-storage = "*" gunicorn = "*" -apiflask = {extras = ["yaml"], version = "*"} [dev-packages] pytest = "*" diff --git a/voting_api/Pipfile.lock b/voting_api/Pipfile.lock index 2d454c9..9dd5806 100644 --- a/voting_api/Pipfile.lock +++ b/voting_api/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "2e43accf1c1c18a4badf42d076ca54bf168b442d0e7777a3476c2e9984755850" + "sha256": "5cb7384bb2e2854c343454e71172d310b52063981822e2326f10dd719aeb0f5a" }, "pipfile-spec": 6, "requires": { @@ -16,32 +16,13 @@ ] }, "default": { - "apiflask": { - "extras": [ - "yaml" - ], - "hashes": [ - "sha256:8586c1f845f6b17f948ecbc6ea26837532cc32953379553c4a78bf9498b2c082", - "sha256:88db5a539cc155e35d9636d99b434d00ca6c0b23e7c87c8321ec9dc980535366" - ], - "markers": "python_version >= '3.8'", - "version": "==2.1.1" - }, - "apispec": { - "hashes": [ - "sha256:708a9a6e6ccd5e69cd73bf75b41e7ed5ea8866f8a4539f419db3df642789bb1e", - "sha256:c03a4d848ae70e9bb2269dd4e4d30d8ec7ec069d24ef9e9b422e3cbd1a9fe794" - ], - "markers": "python_version >= '3.8'", - "version": "==6.5.0" - }, "blinker": { "hashes": [ - "sha256:c3f865d4d54db7abc53758a01601cf343fe55b84c1de4e3fa910e420b438d5b9", - "sha256:e6820ff6fa4e4d1d8e2747c2283749c3f547e4fee112b98555cdcdae32996182" + "sha256:1779309f71bf239144b9399d06ae925637cf6634cf6bd131104184531bf67c01", + "sha256:8f77b09d3bf7c795e969e9486f39c2c5e9c39d4ee07424be2bc594ece9642d83" ], "markers": "python_version >= '3.8'", - "version": "==1.7.0" + "version": "==1.8.2" }, "cachetools": { "hashes": [ @@ -165,43 +146,28 @@ }, "flask": { "hashes": [ - "sha256:3232e0e9c850d781933cf0207523d1ece087eb8d87b23777ae38456e2fbe7c6e", - "sha256:822c03f4b799204250a7ee84b1eddc40665395333973dfb9deebfe425fefcb7d" + "sha256:34e815dfaa43340d1d15a5c3a02b8476004037eb4840b34910c6e21679d288f3", + "sha256:ceb27b0af3823ea2737928a4d99d125a06175b8512c445cbd9a9ce200ef76842" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==3.0.2" - }, - "flask-httpauth": { - "hashes": [ - "sha256:66568a05bc73942c65f1e2201ae746295816dc009edd84b482c44c758d75097a", - "sha256:a58fedd09989b9975448eef04806b096a3964a7feeebc0a78831ff55685b62b0" - ], - "version": "==4.8.0" - }, - "flask-marshmallow": { - "hashes": [ - "sha256:d0f79eb9743f0c530a3d9e848503e1f2228e6b35a819c91e913af02e68421805", - "sha256:ddd2a7c8db5e00a8d56c8ca5f651efae1de7d76b7d821b56ccc2caf09135ad12" - ], - "markers": "python_version >= '3.8'", - "version": "==1.2.0" + "version": "==3.0.3" }, "google-api-core": { "hashes": [ - "sha256:610c5b90092c360736baccf17bd3efbcb30dd380e7a6dc28a71059edb8bd0d8e", - "sha256:9df18a1f87ee0df0bc4eea2770ebc4228392d8cc4066655b320e2cfccb15db95" + "sha256:8661eec4078c35428fd3f69a2c7ee29e342896b70f01d1a1cbcb334372dd6251", + "sha256:cf1b7c2694047886d2af1128a03ae99e391108a08804f87cfd35970e49c9cd10" ], "markers": "python_version >= '3.7'", - "version": "==2.17.1" + "version": "==2.19.0" }, "google-auth": { "hashes": [ - "sha256:80b8b4969aa9ed5938c7828308f20f035bc79f9d8fb8120bf9dc8db20b41ba30", - "sha256:9fd67bbcd40f16d9d42f950228e9cf02a2ded4ae49198b27432d0cded5a74c38" + "sha256:672dff332d073227550ffc7457868ac4218d6c500b155fe6cc17d2b13602c360", + "sha256:d452ad095688cd52bae0ad6fafe027f6a6d6f560e810fec20914e17a09526415" ], "markers": "python_version >= '3.7'", - "version": "==2.28.2" + "version": "==2.29.0" }, "google-cloud-core": { "hashes": [ @@ -213,12 +179,12 @@ }, "google-cloud-storage": { "hashes": [ - "sha256:5d9237f88b648e1d724a0f20b5cde65996a37fe51d75d17660b1404097327dd2", - "sha256:7560a3c48a03d66c553dc55215d35883c680fe0ab44c23aa4832800ccc855c74" + "sha256:91a06b96fb79cf9cdfb4e759f178ce11ea885c79938f89590344d079305f5852", + "sha256:dda485fa503710a828d01246bd16ce9db0823dc51bbca742ce96a6817d58669f" ], "index": "pypi", "markers": "python_version >= '3.7'", - "version": "==2.15.0" + "version": "==2.16.0" }, "google-crc32c": { "hashes": [ @@ -304,44 +270,44 @@ }, "googleapis-common-protos": { "hashes": [ - "sha256:4750113612205514f9f6aa4cb00d523a94f3e8c06c5ad2fee466387dc4875f07", - "sha256:83f0ece9f94e5672cced82f592d2a5edf527a96ed1794f0bab36d5735c996277" + "sha256:17ad01b11d5f1d0171c06d3ba5c04c54474e883b66b949722b4938ee2694ef4e", + "sha256:ae45f75702f7c08b541f750854a678bd8f534a1a6bace6afe975f1d0a82d6632" ], "markers": "python_version >= '3.7'", - "version": "==1.62.0" + "version": "==1.63.0" }, "gunicorn": { "hashes": [ - "sha256:3213aa5e8c24949e792bcacfc176fef362e7aac80b76c56f6b5122bf350722f0", - "sha256:88ec8bff1d634f98e61b9f65bc4bf3cd918a90806c6f5c48bc5603849ec81033" + "sha256:350679f91b24062c86e386e198a15438d53a7a8207235a78ba1b53df4c4378d9", + "sha256:4a0b436239ff76fb33f11c07a16482c521a7e09c1ce3cc293c2330afe01bec63" ], "index": "pypi", - "markers": "python_version >= '3.5'", - "version": "==21.2.0" + "markers": "python_version >= '3.7'", + "version": "==22.0.0" }, "idna": { "hashes": [ - "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca", - "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f" + "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc", + "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0" ], "markers": "python_version >= '3.5'", - "version": "==3.6" + "version": "==3.7" }, "itsdangerous": { "hashes": [ - "sha256:2c2349112351b88699d8d4b6b075022c0808887cb7ad10069318a8b0bc88db44", - "sha256:5dbbc68b317e5e42f327f9021763545dc3fc3bfe22e6deb96aaf1fc38874156a" + "sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef", + "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173" ], - "markers": "python_version >= '3.7'", - "version": "==2.1.2" + "markers": "python_version >= '3.8'", + "version": "==2.2.0" }, "jinja2": { "hashes": [ - "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa", - "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90" + "sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369", + "sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d" ], "markers": "python_version >= '3.7'", - "version": "==3.1.3" + "version": "==3.1.4" }, "markupsafe": { "hashes": [ @@ -409,14 +375,6 @@ "markers": "python_version >= '3.7'", "version": "==2.1.5" }, - "marshmallow": { - "hashes": [ - "sha256:4e65e9e0d80fc9e609574b9983cf32579f305c718afb30d7233ab818571768c3", - "sha256:f085493f79efb0644f270a9bf2892843142d80d7174bbbd2f3713f2a589dc633" - ], - "markers": "python_version >= '3.8'", - "version": "==3.21.1" - }, "packaging": { "hashes": [ "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5", @@ -425,6 +383,14 @@ "markers": "python_version >= '3.7'", "version": "==24.0" }, + "proto-plus": { + "hashes": [ + "sha256:89075171ef11988b3fa157f5dbd8b9cf09d65fffee97e29ce403cd8defba19d2", + "sha256:a829c79e619e1cf632de091013a4173deed13a55f326ef84f05af6f50ff4c82c" + ], + "markers": "python_version >= '3.6'", + "version": "==1.23.0" + }, "protobuf": { "hashes": [ "sha256:19b270aeaa0099f16d3ca02628546b8baefe2955bbe23224aaf856134eccf1e4", @@ -444,83 +410,27 @@ }, "pyasn1": { "hashes": [ - "sha256:4439847c58d40b1d0a573d07e3856e95333f1976294494c325775aeca506eb58", - "sha256:6d391a96e59b23130a5cfa74d6fd7f388dbbe26cc8f1edf39fdddf08d9d6676c" + "sha256:3a35ab2c4b5ef98e17dfdec8ab074046fbda76e281c5a706ccd82328cfc8f64c", + "sha256:cca4bb0f2df5504f02f6f8a775b6e416ff9b0b3b16f7ee80b5a3153d9b804473" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==0.5.1" + "markers": "python_version >= '3.8'", + "version": "==0.6.0" }, "pyasn1-modules": { "hashes": [ - "sha256:5bd01446b736eb9d31512a30d46c1ac3395d676c6f3cafa4c03eb54b9925631c", - "sha256:d3ccd6ed470d9ffbc716be08bd90efbd44d0734bc9303818f7336070984a162d" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==0.3.0" - }, - "pyyaml": { - "hashes": [ - "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5", - "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc", - "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df", - "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741", - "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206", - "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27", - "sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595", - "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62", - "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98", - "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696", - "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290", - "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9", - "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d", - "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6", - "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867", - "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47", - "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486", - "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6", - "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3", - "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007", - "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938", - "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0", - "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c", - "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735", - "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d", - "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28", - "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4", - "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba", - "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8", - "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef", - "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5", - "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd", - "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3", - "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0", - "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515", - "sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c", - "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c", - "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924", - "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34", - "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43", - "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859", - "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673", - "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54", - "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a", - "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b", - "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab", - "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa", - "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c", - "sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585", - "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d", - "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f" - ], - "version": "==6.0.1" + "sha256:831dbcea1b177b28c9baddf4c6d1013c24c3accd14a1873fffaa6a2e905f17b6", + "sha256:be04f15b66c206eed667e0bb5ab27e2b1855ea54a842e5037738099e8ca4ae0b" + ], + "markers": "python_version >= '3.8'", + "version": "==0.4.0" }, "requests": { "hashes": [ - "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f", - "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1" + "sha256:dd951ff5ecf3e3b3aa26b40703ba77495dab41da839ae72ef3c8e5d8e2433289", + "sha256:fc06670dd0ed212426dfeb94fc1b983d917c4f9847c863f313c9dfaaffb7c23c" ], - "markers": "python_version >= '3.7'", - "version": "==2.31.0" + "markers": "python_version >= '3.8'", + "version": "==2.32.2" }, "rsa": { "hashes": [ @@ -538,31 +448,23 @@ "markers": "python_version >= '3.8'", "version": "==2.2.1" }, - "webargs": { - "hashes": [ - "sha256:22324305fbca6a2c4cce1235280e8b56372fb3211a8dac2ac8ed1948315a6f53", - "sha256:ea99368214a4ce613924be99d71db58c269631e95eff4fa09b7354e52dc006a5" - ], - "markers": "python_version >= '3.8'", - "version": "==8.4.0" - }, "werkzeug": { "hashes": [ - "sha256:507e811ecea72b18a404947aded4b3390e1db8f826b494d76550ef45bb3b1dcc", - "sha256:90a285dc0e42ad56b34e696398b8122ee4c681833fb35b8334a095d82c56da10" + "sha256:097e5bfda9f0aba8da6b8545146def481d06aa7d3266e7448e2cccf67dd8bd18", + "sha256:fc9645dc43e03e4d630d23143a04a7f947a9a3b5727cd535fdfe155a17cc48c8" ], "markers": "python_version >= '3.8'", - "version": "==3.0.1" + "version": "==3.0.3" } }, "develop": { "exceptiongroup": { "hashes": [ - "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14", - "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68" + "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad", + "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16" ], "markers": "python_version < '3.11'", - "version": "==1.2.0" + "version": "==1.2.1" }, "iniconfig": { "hashes": [ @@ -582,20 +484,20 @@ }, "pluggy": { "hashes": [ - "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981", - "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be" + "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", + "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669" ], "markers": "python_version >= '3.8'", - "version": "==1.4.0" + "version": "==1.5.0" }, "pytest": { "hashes": [ - "sha256:2a8386cfc11fa9d2c50ee7b2a57e7d898ef90470a7a34c4b949ff59662bb78b7", - "sha256:ac978141a75948948817d360297b7aae0fcb9d6ff6bc9ec6d514b85d5a65c044" + "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd", + "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==8.1.1" + "version": "==8.2.1" }, "tomli": { "hashes": [ diff --git a/voting_api/service.yaml b/voting_api/service.yaml index d0d5b72..866f595 100644 --- a/voting_api/service.yaml +++ b/voting_api/service.yaml @@ -1,11 +1,11 @@ apiVersion: serving.knative.dev/v1 kind: Service metadata: - name: voting-api + name: votingapi spec: template: metadata: - name: ${REVISION_NAME} + name: ${IMAGE} spec: containers: - image: ${IMAGE} diff --git a/voting_api/tests/test_api.py b/voting_api/tests/test_api.py index e0c5386..e123071 100644 --- a/voting_api/tests/test_api.py +++ b/voting_api/tests/test_api.py @@ -1,4 +1,4 @@ def test_get_health(client): response = client.get('/health') - assert b'OK' == response.data + assert 'OK' == response.json['status'] assert 200 == response.status_code diff --git a/voting_api/voting/api.py b/voting_api/voting/api.py index 29efc34..14d74aa 100644 --- a/voting_api/voting/api.py +++ b/voting_api/voting/api.py @@ -1,39 +1,20 @@ -from pathlib import Path - -from apiflask import APIFlask -from flask import jsonify, request +from flask import Flask jsonify, request +from voting.model import art from voting.storage import art_storage def create_app(): - app = APIFlask(__name__, title='Artist 2D Voting API', spec_path='/openapi.yaml') + app = Flask(__name__) return app app = create_app() -app.config.update({ - 'AUTO_SERVERS': False, - 'LOCAL_SPEC_PATH': Path(app.root_path) / 'openapi.yaml', - 'OPENAPI_VERSION': '2.0', - 'SPEC_FORMAT': 'yaml', - 'SYNC_LOCAL_SPEC': True, -}) - - -@app.spec_processor -def google_endpoints_spec(spec): - spec['host'] = 'gateway-c24bw3cnyq-wl.a.run.app' - spec['x-google-backend'] = { - 'address': 'voting-api', - 'protocol': 'h2', - } - return spec - - -@app.get("/health") + + +@app.route("/health") def health_check(): - return 'OK' + return jsonify({'status': 'OK'}) @app.get("/art")