recruit-tech / casval-rem Goto Github PK
View Code? Open in Web Editor NEWCasval REM (Casval Remote Execution Module)
Casval REM (Casval Remote Execution Module)
APIの変更時に本番環境が更新されるように変更
Pythonコード中に定数定義しているもののうち、環境変数経由で渡した方が良いものを洗い出し、 getenv
を通じた取得方法に変える。
例
AWS_IP_RANGES_URL = "https://ip-ranges.amazonaws.com/ip-ranges.json"
Chaliceのconfig.jsonにいくつか数値型の定義値がありますが、これらをそのまま数値として使うと、「str型なのにint型として使うな」という種のエラーが発生します。Chaliceの制限で、環境変数に数値は指定できないので、定義値を使ってる箇所を全て int()
していただけますか。
TOKEN_EXPIRATION_IN_HOUR
って定義をconfig.jsonに移したのに、コードで参照されてない。
config.jsonは文字列型なので、コードを修正する際は、int()
するように注意。
./apis/base.py:17:TOKEN_EXPIRATION_IN_HOUR = 3
./apis/base.py:82: expiration_time = datetime.datetime.now() + datetime.timedelta(hours=TOKEN_EXPIRATION_IN_HOUR)
./core/validators.py:22:MAX_COMMENT_LENGTH = os.environ["MAX_COMMENT_LENGTH"]
./core/validators.py:120: comment = StringField(max_length=MAX_COMMENT_LENGTH, min_length=0)
./core/validators.py:23:MIN_SCAN_DURATION_IN_SECONDS = 3600 * os.environ["MIN_SCAN_DURATION_IN_SECONDS"]
./core/validators.py:149: if scan_duration.days is 0 and scan_duration.seconds < MIN_SCAN_DURATION_IN_SECONDS:
./core/validators.py:152: MIN_SCAN_DURATION_IN_SECONDS
./core/validators.py:24:SCAN_SCHEDULABLE_DAYS_FROM_NOW = os.environ["SCAN_SCHEDULABLE_DAYS_FROM_NOW"]
./core/validators.py:142: if start_from_now.days > SCAN_SCHEDULABLE_DAYS_FROM_NOW:
./core/validators.py:144: "'start_at' must be within {} days from now.".format(SCAN_SCHEDULABLE_DAYS_FROM_NOW)
./core/validators.py:25:SCAN_SCHEDULABLE_DAYS_FROM_START_DATE = os.environ["SCAN_SCHEDULABLE_DAYS_FROM_START_DATE"]
./core/validators.py:155: if scan_duration.days > SCAN_SCHEDULABLE_DAYS_FROM_START_DATE:
./core/validators.py:158: SCAN_SCHEDULABLE_DAYS_FROM_START_DATE
ついでに、これは使われてないので、置き換えた方がいい。 int()
を忘れずに。
AUDIT_GET_DEFAULT_COUNT
Pythonコードの可読性向上のため、説明変数を導入。
bf. message_num = response["Attributes"]["ApproximateNumberOfMessages"]
af.
message = response["Attributes"]
message_num = message["ApproximateNumberOfMessages"]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.