gsmonni / ldapsvc

0 stars 1 forks source link

fails to load mock data.. #17

Closed gedw99 closed 10 months ago

gedw99 commented 10 months ago

just hit this. On on Mac...

make run  
go clean
rm -rf coverage.out
rm -rf release
go build -o release/ldapsvc ./cmd/main.go
./release/ldapsvc
2023/12/21 15:34:37 configuration loaded from data/conf/conf.json
--certificate-use-tls=false
--certificate-use-mtls=false
--certificate-ca-file=/Users/gianstefanomonni/git/ladapsvc/data/certs/ca/cacert.pem
--certificate-cert-file=/Users/gianstefanomonni/git/ladapsvc/data/certs/clientcert/clientcert.pem
--certificate-key-file=/Users/gianstefanomonni/git/ladapsvc/data/certs/clientcert/clientkey.pem
--certificate-ca-path=/Users/gianstefanomonni/git/ladapsvc/data/certs/ca/
--local-address=
--port=443
--save-last-config=true
--ldap-bind-string=cn=admin,dc=example,dc=example
--ldap-bind-password=mypass
--ldap-base-dn=
--ldap-server=localhost
--ldap-port=389
--ldap-use-ldaps=false
--ldap-mock=true
--ldap-mock-data-file=data/ldapsvc/ldap-data.json
--ldap-mock-items-num=20 <nil>
2023/12/21 15:34:37 cannot build web-service(cannot build LDAP provider (error while creating mock-data (cannot load LDAP mock-data from file (invalid character '"' after object key:value pair))))
gedw99 commented 10 months ago

https://github.com/gedw99/ldapsvc/actions/runs/7290045069

I am cross OS testing.

gedw99 commented 10 months ago

Must be the hard coded paths ...

https://github.com/gsmonni/ldapsvc/blob/main/data/conf/default.json#L8

gedw99 commented 10 months ago

The config system is super nice. can override file based config with cli and env variables.

I guess I just need to gen mock data that does not have hardcoded paths.

Maybe even have a data-templates folder that we know works as a base for running and tests ?

gsmonni commented 10 months ago

@gedw99 ill have a look and submit a PR in the next 1-2 days

gsmonni commented 10 months ago

Must be the hard coded paths ...

https://github.com/gsmonni/ldapsvc/blob/main/data/conf/default.json#L8

yep that looks like it, got to clean up the code.

gsmonni commented 10 months ago

@gedw99 just tested on my macbook, and it works fine...

gianstefanomonni@gsm-mb-m2air ldapsvc % git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
gianstefanomonni@gsm-mb-m2air ldapsvc % go run ./...
2023/12/21 20:46:27 configuration loaded from data/conf/conf.json
--certificate-use-tls=false
--certificate-use-mtls=false
--certificate-ca-file=data/certs/ca/cacert.pem
--certificate-cert-file=data/certs/clientcert/clientcert.pem
--certificate-key-file=data/certs/clientcert/clientkey.pem
--certificate-ca-path=data/certs/ca/
--local-address=
--port=443
--save-last-config=true
--ldap-bind-string=cn=admin,dc=example,dc=example
--ldap-bind-password=mypass
--ldap-base-dn=
--ldap-server=localhost
--ldap-port=389
--ldap-use-ldaps=false
--ldap-mock=true
--ldap-mock-data-file=data/ldapsvc/ldap-data.json
--ldap-mock-items-num=20 <nil>
gedw99 commented 10 months ago

Thanks mate !!