You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code for rtypes (A, CNAME, etc. as well as custom types like CF_REDIRECT) is spread over many parts of the code base.
For example, if we were to remove CF_REDIRECT we'd have to edit code in providers/cloudflare, documentation/language-reference/domain-modifiers, helpers.js, integrationTest/integration_test.go, pkg/js/parse_tests, and more!
The code for rtypes is spilt between helpers.js (written in Javascript) and the Go code. This requires knowledge of two languages, instead of one. The Javascript can be more complex (especially for LOC) and yet we have no testing infrastructure for Javascript.
Proposed solution:
Ideally everything related to a particular rtypes would be isolated to a single directory that includes code, documentation, tests, etc. exclusively for that rtype.
I don't think we can get there in one step, but I think we can improve the current situation.
Proposal:
Move as much code out of helpers.js as possible. Simply gather the user input and send it to the Go code. Go can do the validation, create the RecordConfig, process any metadata, etc.
rtypes should be defined in $git/rtypes/NAME/ or $git/providers/PROVIDERNAME/rtypes/NAME/ where NAME is the rtype name.
rtypes documentation should be in $git/rtypes/NAME/documentation/ or $git/providers/PROVIDERNAME/rtypes/NAME/documentation/. The documentation system should find it there automagicallly.
In places where rtype code must be included outside those directories, create Go interfaces
Implementation:
I'm using #3035 (CF_SINGLE_REDIRECT) as an opportunity to improve some of these issues.
I've implemented a new way to pass information about records from helpers.js to the Go code. To add CF_SINGLE_REDIRECT literally 1 line is added: var CF_SINGLE_REDIRECT = rawrecordBuilder('CF_SINGLE_REDIRECT');
The code for CF_SINGLE_REDIRECT is in $git/providers/cloudflare/rtypes/cfsingleredirect/
No change to where documentation is (that's going to require changes to the go generate code) nor other changes. However this is a start.
The text was updated successfully, but these errors were encountered:
CC @cafferata
Problem statement:
For example, if we were to remove CF_REDIRECT we'd have to edit code in providers/cloudflare, documentation/language-reference/domain-modifiers, helpers.js, integrationTest/integration_test.go, pkg/js/parse_tests, and more!
Proposed solution:
Ideally everything related to a particular rtypes would be isolated to a single directory that includes code, documentation, tests, etc. exclusively for that rtype.
I don't think we can get there in one step, but I think we can improve the current situation.
Proposal:
$git/rtypes/NAME/
or$git/providers/PROVIDERNAME/rtypes/NAME/
whereNAME
is the rtype name.$git/rtypes/NAME/documentation/
or$git/providers/PROVIDERNAME/rtypes/NAME/documentation/
. The documentation system should find it there automagicallly.Implementation:
I'm using #3035 (CF_SINGLE_REDIRECT) as an opportunity to improve some of these issues.
var CF_SINGLE_REDIRECT = rawrecordBuilder('CF_SINGLE_REDIRECT');
CF_SINGLE_REDIRECT
is in$git/providers/cloudflare/rtypes/cfsingleredirect/
No change to where documentation is (that's going to require changes to the go generate code) nor other changes. However this is a start.
The text was updated successfully, but these errors were encountered: