Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Monad m => Command a m
- evaluate :: Command a m => a -> m ()
- data ReadConfCrypt = ReadConfCrypt
- data AddConfCrypt = AddConfCrypt {}
- data EditConfCrypt = EditConfCrypt {}
- data DeleteConfCrypt = DeleteConfCrypt {}
- data ValidateConfCrypt = ValidateConfCrypt
- data NewConfCrypt = NewConfCrypt
- data FileAction
- genNewFileState :: (Monad m, MonadError ConfCryptError m) => Map ConfCryptElement LineNumber -> [(ConfCryptElement, FileAction)] -> m (Map ConfCryptElement LineNumber)
- writeFullContentsToBuffer :: (Monad m, MonadWriter [Text] m) => Bool -> Map ConfCryptElement LineNumber -> m ()
Commands
class Monad m => Command a m Source #
All confcrypt commands can be generalized into an evaluate
call. In reality, instances likely
need to provide some environment, although that's not required as everything could be contained
as record fields of the command argument itself.
In reality the return type of evalutate
is Text
, this needs to be cleaned up in the upcoming version.
Instances
Supported Commands
data ReadConfCrypt Source #
Read and return the full contents of an encrypted file. Provides support for using a local RSA key or an externl KMS service
Instances
(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ReadConfCrypt (ConfCryptM m key) Source # | |
Defined in ConfCrypt.Commands evaluate :: ReadConfCrypt -> ConfCryptM m key () Source # |
data AddConfCrypt Source #
Used to add a new config parameter to the file
Instances
data EditConfCrypt Source #
Modify the value or type of a parameter in-place. This should result in a diff touching only the impacted lines. Very important that this property holds to make reviews easier.
Instances
data DeleteConfCrypt Source #
Removes a particular parameter and schema from the config file. This does not require an encryption key because the lines may simply be deleted based on the parameter name.
Instances
data ValidateConfCrypt Source #
Run all of the rules in Validation
on this file.
Instances
(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ValidateConfCrypt (ConfCryptM m key) Source # | |
Defined in ConfCrypt.Commands evaluate :: ValidateConfCrypt -> ConfCryptM m key () Source # |
data NewConfCrypt Source #
Dumps the contents of defaultLines
to the output buffer. This is the same example config used
in the readme.
Instances
Monad m => Command NewConfCrypt (ConfCryptM m ()) Source # | |
Defined in ConfCrypt.Commands evaluate :: NewConfCrypt -> ConfCryptM m () () Source # |
Utilities
data FileAction Source #
Commands may perform one of the following operations to a line of a confcrypt file
Exported for testing
:: (Monad m, MonadError ConfCryptError m) | |
=> Map ConfCryptElement LineNumber | initial file state |
-> [(ConfCryptElement, FileAction)] | edits |
-> m (Map ConfCryptElement LineNumber) | new file, with edits applied in-place |
Given a known file state and some edits, apply the edits and produce the new file contents
writeFullContentsToBuffer :: (Monad m, MonadWriter [Text] m) => Bool -> Map ConfCryptElement LineNumber -> m () Source #
Writes the provided ConfCryptFile
(provided as a Map) to the output buffer in line-number order. This
allows for producing an easily diffable output and makes in-place edits easy to spot in source control diffs.