@@ -822,15 +822,34 @@ func bundleFromManifest(ctx context.Context, manifestFile *os.File, observer Dep
822822 }
823823 }
824824
825- hasConfig := function .DisplayName != "" || function .Generator != "" || len (routes ) > 0 || len (function .BuildData ) > 0 || function .Priority != 0
825+ hasConfig := function .DisplayName != "" || function .Generator != "" || len (routes ) > 0 || len (function .BuildData ) > 0 || function .Priority != 0 || function . TrafficRules != nil
826826 if hasConfig {
827- functionsConfig [ file . Name ] = models.FunctionConfig {
827+ cfg : = models.FunctionConfig {
828828 DisplayName : function .DisplayName ,
829829 Generator : function .Generator ,
830830 Routes : routes ,
831831 BuildData : function .BuildData ,
832832 Priority : int64 (function .Priority ),
833833 }
834+
835+ if function .TrafficRules != nil {
836+ cfg .TrafficRules = & models.TrafficRulesConfig {
837+ Action : & models.TrafficRulesConfigAction {
838+ Type : function .TrafficRules .Action .Type ,
839+ Config : & models.TrafficRulesConfigActionConfig {
840+ Aggregate : function .TrafficRules .Action .Config .Aggregate ,
841+ RateLimitConfig : & models.TrafficRulesRateLimitConfig {
842+ Algorithm : function .TrafficRules .Action .Config .RateLimitConfig .Algorithm ,
843+ WindowSize : int64 (function .TrafficRules .Action .Config .RateLimitConfig .WindowSize ),
844+ WindowLimit : int64 (function .TrafficRules .Action .Config .RateLimitConfig .WindowLimit ),
845+ },
846+ To : function .TrafficRules .Action .Config .To ,
847+ },
848+ },
849+ }
850+ }
851+
852+ functionsConfig [file .Name ] = cfg
834853 }
835854
836855 functions .Add (file .Name , file )
0 commit comments