-
Notifications
You must be signed in to change notification settings - Fork 14
/
settings.py
136 lines (129 loc) · 4.41 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright 2018 Autodesk, Inc. All rights reserved.
#
# Use of this software is subject to the terms of the Autodesk license agreement
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
"""
Flow Production Tracking Jira sync settings
"""
import os
import sys
import logging
# Documentation for these settings are available at
# https://developer.shotgridsoftware.com/sg-jira-bridge/settings.html
# Allow users to define their sensitive data in a .env file and
# load it in environment variables with python-dotenv.
# https://pypi.org/project/python-dotenv/
from dotenv import load_dotenv
load_dotenv(override=True)
# fmt: off
# Flow Production Tracking site and credentials
SHOTGUN = {
"site": os.environ.get("SGJIRA_SG_SITE"),
"script_name": os.environ.get("SGJIRA_SG_SCRIPT_NAME"),
"script_key": os.environ.get("SGJIRA_SG_SCRIPT_KEY"),
"http_proxy": None, # If set, the Flow Production Tracking connection is done through this proxy.
}
# Jira site and credentials, the user name needs to be an email address or
# the user login name, e.g. ford_escort for "Ford Escort".
JIRA = {
"site": os.environ.get("SGJIRA_JIRA_SITE"),
"user": os.environ.get("SGJIRA_JIRA_USER"),
"secret": os.environ.get("SGJIRA_JIRA_USER_SECRET"),
}
# Define logging
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
# Settings for the parent of all loggers
"root": {
# Set default logging level for all loggers and add the console and
# file handlers
"level": "DEBUG",
"handlers": [
"console", "file"
],
},
"loggers": {
# Set web server level to WARNING so we don't hear about every request
# If you want to see the requests in the logs, set this to INFO.
"webapp": {
"level": "WARNING"
}
},
# Some formatters, mainly as examples
"formatters": {
"verbose": {
"format": "%(asctime)s %(levelname)s [%(module)s %(process)d %(thread)d] %(message)s"
},
"standard": {
"format": "%(asctime)s %(levelname)s [%(module)s] %(message)s"
},
"simple": {
"format": "%(levelname)s:%(name)s:%(message)s"
},
},
# Define the logging handlers
"handlers": {
# Print out any message to stdout
"console": {
"level": "INFO",
"class": "logging.StreamHandler",
"formatter": "standard"
},
"file": {
"level": "INFO",
"class": "logging.handlers.RotatingFileHandler",
"formatter": "standard",
# this location should be updated to where you store logs
"filename": "/tmp/sg_jira.log",
"maxBytes": 1024 * 1024,
"backupCount": 5
},
},
}
# Sync settings. Keys are settings name.
# Add the examples folder to the Python path so the syncers can be loaded.
# Additional paths can be added for custom syncers
sys.path.append(os.path.abspath("./examples"))
SYNC = {
"default": {
# The syncer class to use
"syncer": "sg_jira.TaskIssueSyncer",
# And its specific settings which are passed to its __init__ method
"settings": {
"issue_type": "Task"
},
},
"asset_hierarchy": {
# The syncer class to use
"syncer": "asset_hierarchy.AssetHierarchySyncer",
# And its specific settings which are passed to its __init__ method
"settings": {
"asset_issue_type": "Story",
"task_issue_type": "Task",
},
},
"timelog": {
# The syncer class to use
"syncer": "timelog_worklog.TimelogWorklogSyncer",
# And its specific settings which are passed to its __init__ method
"settings": {
"issue_type": "Task",
# If True, when a worklog is deleted in Jira it will also be deleted in Flow Production Tracking
"sync_sg_timelog_deletion": True,
# If True, when a timelog is deleted in Flow Production Tracking, it will also be deleted in Jira
"sync_jira_worklog_deletion": True,
},
},
"test": {
# Example of a custom syncer with an additional parameter to define
# a log level.
"syncer": "example_sync.ExampleSync",
"settings": {
"log_level": logging.DEBUG
},
}
}
# fmt: on