File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -135,4 +135,31 @@ with lib; {
135135 description = mdDoc "Payload builder URL." ;
136136 } ;
137137 } ;
138+
139+ keymanager = {
140+ enable = lib . mkEnableOption ( mdDoc "Enable the REST keymanager API" ) ;
141+ address = mkOption {
142+ type = types . str ;
143+ default = "127.0.0.1" ;
144+ description = mdDoc "Listening port for the REST keymanager API." ;
145+ } ;
146+
147+ port = mkOption {
148+ type = types . port ;
149+ default = 5052 ;
150+ description = mdDoc "Listening port for the REST keymanager API." ;
151+ } ;
152+
153+ allow-origin = mkOption {
154+ type = types . nullOr types . str ;
155+ default = null ;
156+ description = mdDoc "Limit the access to the Keymanager API to a particular hostname (for CORS-enabled clients such as browsers)." ;
157+ } ;
158+
159+ token-file = mkOption {
160+ type = types . nullOr types . path ;
161+ default = null ;
162+ description = mdDoc "A file specifying the authorization token required for accessing the keymanager API." ;
163+ } ;
164+ } ;
138165}
Original file line number Diff line number Diff line change 7474 then ''--jwt-secret="%d/jwt-secret"''
7575 else "" ;
7676
77+ keymanagerTokenFile =
78+ if cfg . args . keymanager . token-file != null
79+ then ''--keymanager-token-file="%d/keymanager-token-file"''
80+ else "" ;
81+
7782 trustedNodeUrl =
7883 if cfg . args . trusted-node-url != null
7984 then ''--trusted-node-url="${ cfg . args . trusted-node-url } "''
@@ -134,13 +139,14 @@ in {
134139 inherit pathReducer ;
135140 } ;
136141 # filter out certain args which need to be treated differently
137- specialArgs = [ "--network" "--jwt-secret" "--web3-urls" "--trusted-node-url" "--backfill" "--payload-builder" ] ;
142+ specialArgs = [ "--network" "--jwt-secret" "--web3-urls" "--trusted-node-url" "--backfill" "--payload-builder" "--keymanager-token-file" ] ;
138143 isNormalArg = name : ( findFirst ( arg : hasPrefix arg name ) null specialArgs ) == null ;
139144 filteredArgs = builtins . filter isNormalArg args ;
140145 in ''
141146 ${ network } ${ jwtSecret } \
142147 ${ web3Url } \
143148 ${ dataDir } \
149+ ${ keymanagerTokenFile } \
144150 ${ payloadBuilder } \
145151 ${ concatStringsSep " \\ \n " filteredArgs } \
146152 ${ lib . escapeShellArgs cfg . extraArgs }
193199 ( mkIf ( cfg . args . jwt-secret != null ) {
194200 LoadCredential = [ "jwt-secret:${ cfg . args . jwt-secret } " ] ;
195201 } )
202+ ( mkIf ( cfg . args . keymanager . token-file != null ) {
203+ LoadCredential = [ "keymanager-token-file:${ cfg . args . keymanager . token-file } " ] ;
204+ } )
196205 ] ;
197206 } )
198207 )
You can’t perform that action at this time.
0 commit comments