Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 88b6bd9

Browse files
author
Ben Ford
committed
[DEVOPS-834] Faucet component (squashed to single commit on top of develop
1 parent e22d4c1 commit 88b6bd9

27 files changed

+1714
-3
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ result*
103103
# remove when done debugging
104104
1.1.1-1-w/
105105

106-
107106
# Created by https://www.gitignore.io/api/python
108107

109108
### Python ###
@@ -207,3 +206,9 @@ venv.bak/
207206
.mypy_cache/
208207

209208
# End of https://www.gitignore.io/api/python
209+
210+
# Don't include config files with sensitive data or tls certs
211+
/faucet/test-config.json
212+
/faucet/tls/*
213+
/faucet/wallet-source.json
214+
faucet/generated-wallet-details.json

default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ let
7272
cardano-sl-client = addRealTimeTestLogs super.cardano-sl-client;
7373
cardano-sl-generator = addRealTimeTestLogs super.cardano-sl-generator;
7474
cardano-sl-auxx = justStaticExecutablesGitRev super.cardano-sl-auxx;
75-
cardano-sl-wallet-new = justStaticExecutablesGitRev super.cardano-sl-wallet-new;
75+
cardano-sl-wallet-new-static = justStaticExecutablesGitRev self.cardano-sl-wallet-new;
7676
cardano-sl-tools = justStaticExecutablesGitRev (overrideCabal super.cardano-sl-tools (drv: {
7777
# waiting on load-command size fix in dyld
7878
doCheck = ! pkgs.stdenv.isDarwin;
@@ -81,6 +81,7 @@ let
8181
cardano-sl-node-static = justStaticExecutablesGitRev self.cardano-sl-node;
8282
cardano-sl-explorer-static = justStaticExecutablesGitRev self.cardano-sl-explorer;
8383
cardano-report-server-static = justStaticExecutablesGitRev self.cardano-report-server;
84+
cardano-sl-faucet-static = justStaticExecutablesGitRev self.cardano-sl-faucet;
8485

8586
# Undo configuration-nix.nix change to hardcode security binary on darwin
8687
# This is needed for macOS binary not to fail during update system (using http-client-tls)

faucet/.projectile

Whitespace-only changes.

faucet/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright Ben Ford (c) 2018
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of Ben Ford nor the names of other
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

faucet/Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

faucet/cardano-sl-faucet.cabal

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
-- This file has been generated from package.yaml by hpack version 0.18.1.
2+
--
3+
-- see: https://github.com/sol/hpack
4+
5+
name: cardano-sl-faucet
6+
version: 0.1.0.0
7+
description: Cardano SL - faucet
8+
license: MIT
9+
author: Ben Ford
10+
maintainer: [email protected]
11+
copyright: 2018 IOHK
12+
build-type: Simple
13+
cabal-version: >= 1.10
14+
15+
library
16+
hs-source-dirs:
17+
src
18+
build-depends: QuickCheck
19+
, aeson
20+
, aeson-pretty
21+
, base
22+
, base16-bytestring
23+
, bytestring
24+
, cardano-sl-core
25+
, cardano-sl-crypto
26+
, cardano-sl-update
27+
, cardano-sl-util
28+
, cardano-sl-wallet
29+
, cardano-sl-wallet-new
30+
, connection
31+
, cryptonite
32+
, data-default
33+
, directory
34+
, ekg-core
35+
, ekg-statsd
36+
, exceptions
37+
, filepath
38+
, http-api-data
39+
, http-client
40+
, http-client-tls
41+
, lens
42+
, log-warper
43+
, memory
44+
, mmorph
45+
, mtl
46+
, neat-interpolation
47+
, random
48+
, serokell-util
49+
, servant
50+
, servant-client
51+
, servant-client-core
52+
, servant-server
53+
, servant-swagger
54+
, servant-swagger-ui
55+
, stm
56+
, swagger2
57+
, tagged
58+
, text
59+
, text-format
60+
, time
61+
, tls
62+
, wreq
63+
exposed-modules:
64+
Cardano.Faucet
65+
Cardano.Faucet.Swagger
66+
, Cardano.Faucet.Types.Config
67+
, Cardano.Faucet.Types.API
68+
, Cardano.Faucet.Types.Recaptcha
69+
, Cardano.Faucet.Types
70+
, Cardano.Faucet.Metrics
71+
, Cardano.Faucet.Init
72+
, Cardano.WalletClient
73+
default-language: Haskell2010
74+
75+
executable faucet
76+
main-is: Main.hs
77+
hs-source-dirs:
78+
server
79+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
80+
build-depends:
81+
base
82+
, aeson
83+
, bytestring
84+
, cardano-sl-core
85+
, cardano-sl-faucet
86+
, cardano-sl-update
87+
, cardano-sl-util
88+
, cardano-sl-wallet
89+
, cardano-sl-wallet-new
90+
, ekg
91+
, ekg-core
92+
, ekg-statsd
93+
, exceptions
94+
, lens
95+
, log-warper
96+
, mmorph
97+
, mtl
98+
, optparse-applicative
99+
, servant
100+
, servant-client
101+
, servant-server
102+
, text
103+
, wai
104+
, wai-cors
105+
, wai-extra
106+
, warp
107+
default-language: Haskell2010
108+
109+
test-suite cardano-sl-faucet-test
110+
type: exitcode-stdio-1.0
111+
main-is: Spec.hs
112+
hs-source-dirs:
113+
test
114+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
115+
build-depends:
116+
base
117+
, cardano-sl-faucet
118+
, cardano-sl-wallet
119+
, QuickCheck
120+
default-language: Haskell2010

faucet/default.nix

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{ mkDerivation, aeson, aeson-pretty, base, base16-bytestring
2+
, bytestring, cardano-sl-core, cardano-sl-crypto, cardano-sl-update
3+
, cardano-sl-util, cardano-sl-wallet, cardano-sl-wallet-new
4+
, connection, cryptonite, data-default, directory, ekg, ekg-core
5+
, ekg-statsd, exceptions, filepath, http-api-data, http-client
6+
, http-client-tls, lens, log-warper, memory, mmorph, mtl
7+
, neat-interpolation, optparse-applicative, QuickCheck, random
8+
, serokell-util, servant, servant-client, servant-client-core
9+
, servant-server, servant-swagger, servant-swagger-ui, stdenv
10+
, swagger2, tagged, text, text-format, time, tls, wai, wai-cors
11+
, wai-extra, warp, wreq
12+
}:
13+
mkDerivation {
14+
pname = "cardano-sl-faucet";
15+
version = "0.1.0.0";
16+
src = ./.;
17+
isLibrary = true;
18+
isExecutable = true;
19+
libraryHaskellDepends = [
20+
aeson aeson-pretty base base16-bytestring bytestring
21+
cardano-sl-core cardano-sl-crypto cardano-sl-update cardano-sl-util
22+
cardano-sl-wallet cardano-sl-wallet-new connection cryptonite
23+
data-default directory ekg-core ekg-statsd exceptions filepath
24+
http-api-data http-client http-client-tls lens log-warper memory
25+
mmorph mtl neat-interpolation QuickCheck random serokell-util
26+
servant servant-client servant-client-core servant-server
27+
servant-swagger servant-swagger-ui swagger2 tagged text text-format
28+
time tls wreq
29+
];
30+
executableHaskellDepends = [
31+
aeson base bytestring cardano-sl-core cardano-sl-update
32+
cardano-sl-util cardano-sl-wallet cardano-sl-wallet-new ekg
33+
ekg-core ekg-statsd exceptions lens log-warper mmorph mtl
34+
optparse-applicative servant servant-client servant-server text wai
35+
wai-cors wai-extra warp
36+
];
37+
testHaskellDepends = [ base cardano-sl-wallet QuickCheck ];
38+
license = stdenv.lib.licenses.mit;
39+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"wallet-id": "Ae2tdPwUPEZLBG2sEmiv8Y6DqD4LoZKQ5wosXucbLnYoacg2YZSPhMn4ETi"
3+
, "account-index": 2147483648
4+
, "spending-password": "h8rFA03QBsua!DVS4IgfNv4wjT6Wwd"
5+
}
6+

faucet/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<head>
3+
<title>reCAPTCHA demo: Simple page</title>
4+
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
5+
</head>
6+
<body>
7+
<form action="withdraw" method="POST">
8+
<div class="g-recaptcha" data-sitekey="6LcnOGEUAAAAAAfD8NzEOzdLlA0EeKTWyArvzt3j"></div>
9+
<br/>
10+
<input type="text" name="address" value="Submit">
11+
<input type="submit" value="Submit">
12+
</form>
13+
</body>
14+
</html>

faucet/logging.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
termSeveritiesErr: All
2+
loggerTree:
3+
severity: Info+ # severities for «root» logger
4+
withdraw: # logger named «new-logger»
5+
severity: Debug+ # severities for logger «new-logger»

0 commit comments

Comments
 (0)