Closed Bug 1124839 Opened 10 years ago Closed 10 years ago

base: Entity support custom context

Categories

(Taskcluster :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jonasfj, Assigned: jonasfj)

References

Details

Attachments

(1 file)

It would be nice if we would inject some configuration constants when we call Entity.setup() These could just extend the prototype... Additionally, it would be nice, if doing Entity.configure() we specified which configuration properties had to be injected.. Use: var TaskGraph = base.Entity.configure({ ... context: ['schedulerId'] // Configurable constant }) TaskGraph.prototype.status = function() { return { ... schedulerId: this.schedulerId }; }; in bin/server.js var data = require(... var TaskGraph = data.TaskGraph.setup({ ,,, context: { schedulerId: cfg.get('scheduler:schedulerId') // Loaded from configuration } }); This blocks bug 1088920, because we need to port to new entities first...
Attached file Github PR
See description for what this does :) I added lots of tests, so there is a reasonable chance this works...
Attachment #8553290 - Flags: review?(jhford)
Assignee: nobody → jopsen
Comment on attachment 8553290 [details] [review] Github PR Looks good to me and seems like a good feature to have
Attachment #8553290 - Flags: review?(jhford) → review+
Merged will be published with the next version of taskcluster-base
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Component: TaskCluster → General
Product: Testing → Taskcluster
Target Milestone: --- → mozilla41
Version: unspecified → Trunk
Resetting Version and Target Milestone that accidentally got changed...
Target Milestone: mozilla41 → ---
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: