Git Product home page Git Product logo

cronjobs's Introduction

mirror-media-nuxt

鏡週刊網站前端

Build Setup

# install dependencies
$ yarn install

# serve with hot reload at localhost:3000
$ yarn dev

# build for production and launch server
$ yarn build
$ yarn start

# generate static project
$ yarn generate

For detailed explanation on how things work, check out Nuxt.js docs.

Yarn version

因為v2、v3的yarn版本,在執行 yarn dev yarn build 時,會跳出許多錯誤, 所以目前本專案仍採用classic stable version。 截至2022.4.28,最新的classic stable version 為1.22.18,開發時請使用~1.22.0的版本。 To avoid unpredictable error occur when developing, please use Classic Stable version of yarn(~1.22.0).

Environment Variables

變數名稱 資料型態 初始值 變數說明
ENV 字串 'local' 系統環境,目前已知有;localdevstagingproductionlighthouse
REDIS_READ_HOST 字串 'redis-read-host' 讀取用的 Redis hostname or ip
REDIS_WRITE_HOST 字串 'redis-write-host' 寫入用的 Redis hostname or ip
REDIS_AUTH 字串 'redis-auth' Reids 驗證用資訊
NEWEBPAY_KEY 長度為 32 的字串 'newebpay-key' 藍新支付 API key (Premium 訂閱)
NEWEBPAY_IV 長度為 16 的字串 'newebpay-iv' 藍新支付 API iv (Premium 訂閱)
NEWEBPAY_MEMBERSHIP_API_URL 字串 'https://ccore.newebpay.com/MPG/mpg_gateway' 藍新支付 API URL (Premium 訂閱)
NEWEBPAY_PAPERMAG_KEY 字串 'newebpay-papermag-key' 藍新支付 API key (紙本雜誌)
NEWEBPAY_PAPERMAG_IV 字串 'newebpay-papermag-iv' 藍新支付 API iv (紙本雜誌)
NEWEBPAY_PAPERMAG_API_URL 字串 'https://ccore.newebpay.com/MPG/mpg_gateway' 藍新支付 API URL (紙本雜誌)
ISRAFEL_ORIGIN 字串 'israfel-origin' Israfel URL
API_HOST 字串 'api-host' API GATEWAY URL
API_HOST_MEMBERSHIP_GATEWAY 字串 'api-host-membership-gateway' API GATEWAY URL
API_MEMBER_SUBSCRIPTION_GATEWAY 字串 'api-member-subscription-gateway' API GATEWAY URL
IS_AD_DISABLE 布林值 false
PREMIUM_AD_FEATURE_TOGGLE 布林值 false 用 'on' 啟用的數值 ...
ENABLE_CLOUD_LOGGING 布林值 false 開啟 gcloud/logging 行為
LINEPAY_CHANNEL_ID 字串 '' LINE Pay 串接所需的 channel id
LINEPAY_CHANNEL_KEY 字串 '' LINE Pay 串接所需的 channel key
LINEPAY_CLIENT_MODE 字串 'development' 串接 LINE Pay 的模式,數值有 developmentproduction
PUBSUB_LINEPAY_WEBHOOK_TOPIC_NAME 字串 'linepay-webhook-dev' LINE Pay 付款資訊寫入 PubSub 的主題名稱

Feature Toggle

變數名稱 資料型態 初始值 變數說明
EMAIL_VERIFY_FEATURE_TOGGLE 'on', 'off' 'off'
NO_AD_FEATURE_TOGGLE 'on', 'off' 'off'
TOPIC_LIST_FEATURE_TOGGLE 'on', 'off' 'off'
SUBSCRIPTION_PRICE_FEATURE_TOGGLE 'on', 'off' 'off'
HEADER_EXTERNALS_FEATURE_TOGGLE 'on', 'off' 'off'
LINEPAY_PAYMENT_UI_TOGGLE 布林值 false 確認付款頁 LINEPay 支付功能啟用開關

※ 在執行指令時,使用 key=value 的前綴來執行,例如:ENV=dev yarn dev,即可設定執行時的環境變數。

cronjobs's People

Contributors

andyfcx avatar baron-chiu avatar hcchien avatar

Watchers

 avatar  avatar  avatar

cronjobs's Issues

Refactor: Redundant .venv, requirements.txt, exec.sh

https://github.com/mirror-media/cronjobs/blob/main/Dockerfile#L25-L52
不應該在Dockerfile中對目錄做迴圈重複pip install、以及在container中又另開venv
然後為了這個venv又再寫一支exec.sh
同時製造.kube.yml的高度複雜以及低閱讀性

可以處理的方法是另外做一個 venv/ 以後,僅安裝使用到的套件,再使用pip freeze > requirements.txt

不然就會像這份一樣一看過去一堆沒有在使用的package: pymongo, Werkzeug
https://github.com/mirror-media/cronjobs/blob/main/search/esFeed/requirements.txt

ref:

esFeed can't clean post

log shows

Traceback (most recent call last): File "searchFeed.py", line 271, in main(option) File "searchFeed.py", line 87, in main processSearchFeed(fetchedPosts) File "searchFeed.py", line 99, in processSearchFeed cleanedPost = clean(post) File "searchFeed.py", line 192, in clean cleanedPost["brief"] = json.loads(post["brief"])["html"] TypeError: string indices must be integers

log: https://console.cloud.google.com/kubernetes/job/asia-east1-c/tv-dev/cron/search-es-feed-20210311-155735/logs?authuser=0&project=mirror-tv-275709

Refactor: Unnecessary Complexity in Config

Note: helm-tv/cronjobs/config/prod, configs-tv/cronjobs/*/.kube.yml
善用動態語言的特性,config不該寫成複雜的形式,這不是viper

The Zen of Python: Run python3 -m this

Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.

If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.

從settings.py或者需要來自private repo的cred的import或者require的範例:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.